What is the c# equivalent of the following c++:
srand((unsigned)(time(NULL)));
weight=(double)(rand())/(RAND_MAX/2) - 1;
The paramaterless constructor for Random uses "a time-dependent default seed value" so all you need is:
Random rnd = new Random();
return rnd.Next(-1, 1);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With