random number generator

Mike Parker aldacron at gmail.com
Wed Jul 30 22:29:26 PDT 2008


Michael P. wrote:

> Anyways, I tried importing the std.c.stdlib and the std.c.time to use those exact same functions, but I got errors trying to use time(0) as a argument. Forgot to mention I tried that.

FYI, the time function doesn't take a 'number'. It takes a pointer to a 
time_t. If the pointer is non-null, the function stores the returned 
value in the memory to which the argument points. It's common to call 
the function with a null parameter. In C, 0 is often used in code to 
represent null. This is not supported in D. So you have to call the 
function using the null keyword in place of the 0: time(null).


More information about the Digitalmars-d-learn mailing list