How to generate a random number from system clock as seed
Eric P626
ericp at lariennalibrary.com
Sat Jun 8 13:19:30 UTC 2024
I managed to create a random number generator using the following
code:
~~~
auto rng = Random(42);
//....
uniform(0,10,rng);
~~~
Now I want to seed the generator using system time. I looked at
Date & time functions/classes and systime functions/classes. The
problem is that they all require a time zone. But I don't need a
time zone since there is no time zone. I just want the number of
seconds elapsed since jan 1st 1970. In other words, the internal
system clock value.
More information about the Digitalmars-d-learn
mailing list