// assign result of expression to a global (use, operator since srand is type void) int seed = (srand( ( unsigned )time( NULL )), 0); // put the call in a constructor of a class, define an instance of that class. Simply put; rand is driving me nuts. I've been trying to get my teeth into Dev c (v. 4.9.9.2) for the first time and couldn't find anything anywhere which helped me anymore.Nearly all this code is IDE generated or copied from examples - I'm just trying to understand it all.
Hi, I want to use rand in C with visual studio 2010 but I cant initialize srand. I had this includes: #include #include #include time.hbut when using srand( (unsigned)time( NULL ) ); gives me an error:time: identifier not found. This complete program compiles and runs successfully in my copy of VC2010. Srand( (unsigned)time(NULL) ); It’s a very common way to seed the random number generator, and it’s also shown in many books that teach programming. This may look sufficient for most uses (and it does) but nonetheless it’s also used many times where it’s just isn’t random enough.