mercredi 27 février 2019

How to convert a date into a random index in a list?

I need something that generates a random item from a list, but that item is randomised every day and is consistent for all users. This is on a website, and thus using JavaScript (although really I just need the algorithm you'd follow, not necessarily the code itself.

I've got day, month, and year stored in variables, but what could I do to convert this into an integer between 0 and list length?

Thanks!




Aucun commentaire:

Enregistrer un commentaire