vendredi 17 mai 2019

Use a string as seed generator for random number generation in ruby on rails

I have a uuid (ex : ‘a3989f5a-1c4b-11e3-8573-0025906a9230’) which I need to use as a seed for my random number generation in ruby on rails, So that every-time, a request comes with that uuid, I need to get the same sequence of random numbers generated. Is there any other such function that I am missing here. Please note: it is very important that for a given uuid, the same sequence of random numbers need to be generated.

I tried using Kernel.srand() function provided by ruby, however this only accepts integers.

Kernel.srand()




Aucun commentaire:

Enregistrer un commentaire