|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#2
|
|||||
|
|||||
|
Re: Random?
A "pure" random number generator does not exist in either. However, you can make a pseudo-random number generator that's a close enough approximation:
Start a timer before the program: Each time through the loop, divide the timer value by a number like four or nine*, and store the modulus to a variable. The modulus (the % operator) is now your "random" number. * The size of your random number pool will depend on how high you set this. If you want a bigger range of random numbers, set this higher. |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| RAndom C++ Problem | brennerator | Programming | 8 | 15-02-2007 15:04 |
| Random behavior | RedBarons | Programming | 9 | 25-02-2006 23:03 |
| Random Thought | Ricky Q. | Chit-Chat | 32 | 25-10-2002 13:26 |
| How random is random???? | archiver | 1999 | 0 | 23-06-2002 21:59 |
| Random | Marc P. | Chit-Chat | 138 | 13-02-2002 15:11 |