How to generate a uniformly random number U(-1,1) in C#? -
i want generate uniformly distributed random number -1 1 using c#, u(-1,1) in math sign. expected result should real number.
user random.nextdouble() , multiply result 2 subtract 1.
the code:
var rand = new random(); var value = rand.nextdouble() * 2 - 1;
Comments
Post a Comment