lundi 20 juillet 2020

Get or Create Client ID to use as Random Seed

I have a small web project and need to randomize the order of two links as part of an online study. I want to have a random order for each visitor but each visitor should get the same order even after reloading or revisiting the page on a later date.

I see two methods:

  1. Use a fixed identifier such as the MAC address or system name as a seed for a random number generator.
  2. Create a random number and store it on the system either using cookies or some more modern alternative.

I'd rather use the first approach since it doesn't infringe as much on user privacy and stuff regarding GDPR. So, for the first approach, what is a good way to create such a quasi-unique seed for the random number generator using javascript?




Aucun commentaire:

Enregistrer un commentaire