| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
compile error
I'm trying to compile a small program in which I use a random number generator.
The compiler returns an error that says, "void value not ignored as it ought to be" The line that it refers to the error as being in is as follows: x = srand(time(0))%25; Any ideas what's going on? Thanks. ~Dan |
|
#2
|
|||
|
|||
|
Try using this:
// Seed random number generator srand( static_cast< unsigned >( time( NULL ))); // Get random number between 0 and 24 x = rand() % 25; |
![]() |
| Viewing: Dev Articles Community Forums > Programming > C/C++ Help > compile error |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|