Epoch time + msecs

Handyman via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Nov 14 04:14:41 PST 2015


On Friday, 13 November 2015 at 23:12:34 UTC, Steven Schveighoffer 
wrote:
> If you cannot update to the latest compiler

Didn't realised this feature is so new to the compiler.  In my 
case, it is no problem to update the compiler, and I will.  
Thanks!

On Saturday, 14 November 2015 at 03:10:17 UTC, Jonathan M Davis 
wrote:
> auto seed = Clock.currTime().stdTime;
> (...) and you don't have to do any math.

Perfect.

On Saturday, 14 November 2015 at 03:10:17 UTC, Jonathan M Davis 
wrote:
> Alternatively, std.random.unpredictable seed is there 
> specifically to provide an unpredictable seed. It's probably 
> best to just
> use that if you don't have a good reason not to.

Of course.  That's why I mentioned my purpose of using 
Clock.currTime(), in the hope I got corrected in using the right 
and offical seed method which I failed to find, which brings me 
to another point.

The D docs seem very thorough and complete to me but less 
accessible in comparison to, e.g., Perl docs, Php docs, or Ruby 
docs.  In particular I have difficulties in understanding the 
headers of the standard library function specifications (e.g.,: 
auto uniform(string boundaries = "[)", T1, T2, 
UniformRandomNumberGenerator)(T1 a, T2 b, ref 
UniformRandomNumberGenerator urng) if 
(isFloatingPoint!(CommonType!(T1, T2)) && 
isUniformRNG!UniformRandomNumberGenerator);)

These headers are necessary and give loads of information. D is 
no toy language, that's for sure.  Maybe a tutorial should be 
written on how to read such headers and how to read the standard 
library docs in general.  I am making notes for myself, but these 
are of too little quality to be used in the public domain.

Like I said: I am spoiled by scripting languages.

Thanks again, your answers have helped me a lot.



More information about the Digitalmars-d-learn mailing list