mercredi 31 mars 2021

How to choose the parameters for a linear congruential generator?

I am implementing a linear congruential generator in java for a PRNG where I have to choose appropriate parameters of 'm', 'a', 'c' and the seed. My 'm' further needs to be a prime number and 'a' needs to be a primitive root of 'm'.

Let's say that my 'm' is the prime number: 932537. The smallest primitive root of this number is 3 and the largest primitive root is 932532. How do I make the choice of my 'a' parameter? Do I choose a larger primitive root for 'a' or a smaller root?

Then I also wonder how I should resonate regarding the choice of the parameter 'c' and the choice of the seed which further is supposed to be retrieved by the user.




Aucun commentaire:

Enregistrer un commentaire