![]() |
|
#1
|
|||
|
|||
? regarding random number generationHere's something that has bugged me for a while. I know how to seed the random function via the current time:
CPP / C++ / C Code:
|
|
#2
|
|||
|
|||
Re: ? regarding random number generationyou could use the clock() function, which outputs the number of clock ticks since process start. The (slight) problem is that this can be the same on two different instances of the process (unlikely). To remedy that, you could combine time(NULL) and clock(), by addition or multiplication or something.
|
|
#3
|
|||
|
|||
Re: ? regarding random number generationQuote:
Sorry for my ignorance, but when you say "the number of clock ticks", is the clock ticking faster than once per second? If not, the question remains. |
|
#4
|
|||
|
|||
Re: ? regarding random number generationshort answer: yes.
medium-length answer: yes, 1000 times per second in fact. long answer: allow me to cite a few pertinent quotes Quote:
Quote:
|
Recent GIDBlog
Meeting the local Iraqis by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Converting a number amount to text | Godzilla | C++ Forum | 5 | 31-Mar-2006 11:38 |
| Need help generating a random number | Allie | C Programming Language | 7 | 09-Nov-2005 22:18 |
| random number generation issues | Jonnyz007 | C++ Forum | 8 | 27-Oct-2005 19:13 |
| Need Help with my Cards Program (C++) | krisopotamus | C++ Forum | 2 | 06-Oct-2005 16:48 |
| Anyone can write a program code for this??? | chriskan76 | C Programming Language | 1 | 19-Oct-2004 20:25 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The