For my assignment I need to implement a pseudo-random number generator. It takes in a start value (x) and seed. The seed must be generated based on the current date (ticks or something similar).
private long Rnd (double x)
{
//Method that returns a datetime.now Ticks long
var seed=CreateSeed();
// x is the input the user provides
// +1)/3 is added for variance
long randomNumber = Convert.ToInt64((Math.Cos(90 * x * seed)+1)/3);
return randomNumber;
}
What should I improve and change. Thank you for your help and advice.
Aucun commentaire:
Enregistrer un commentaire