How to generate a random number from system clock as seed

monkyyy crazymonkyyy at gmail.com
Sun Jun 9 17:25:36 UTC 2024


On Sunday, 9 June 2024 at 07:11:22 UTC, Eric P626 wrote:
> On Saturday, 8 June 2024 at 21:04:16 UTC, monkyyy wrote:
>> generate is a very rare function and do novices understand 
>> lamdas?
>
> Yes I know lamdas, but try not to use them.
>
> I am not very picky about the exact source of time, I just want 
> a different integer every time I run the program. But while 
> looking at the doc, it seemed complicated because I required 
> time zones, and I could not get the entire time stamp as a 
> single integer.

Im not sure exactly why it automagically works, but it does work, 
the defualt rng is time seeded somehow

> I am not exactly sure what the exclamation points stand for in 
> the first line of code.

templates

its a simplification but assume function headers have two parts, 
a compile time part and a runtime part thats from c; while it 
trys to fill in the compile time part implicitly if theres no 
information and your passing a type in, you use ! to fill the 
compile time header


More information about the Digitalmars-d-learn mailing list