   a _BETTER_ random number generator?
  hey, i'm using rand() but it sux, to say the least.so i'm wondering if you have any (self-written) functions with a TRUE random.ty.   
  You can not really generate true random numbers in an algorithm, as far as I know. They call them pseudo-random generators because it's an algorithm and will eventually repeat itself.Look for Merssenne twister, it's one of the better pseudo-random number generators around.   ;  There is no way to generate truely random numbers from a purely deterministic system like a computer. For truely random numbers you need a stochastic source. The best you can do, like rand does, is to generate a sequence of numbers that looks random, but they will never be truely random, no matter how good the algorithm is.I believe there are equipment you can buy that, for example, produces random numbers from radioactive decay and radiations and such. There's also www.random.org where you can download random data.But if you're only after a pseudo-random sequence generator better than rand, then have a look at boost.   ;  You really can't get true random numbers through software.  What you are looking for is a pseudoramdon generator.   ;  What about sampling the soundcards mic or line-in. there should always be some amount of white noise on it.   ;  You can approach a true random function if you sample a number of near random data and then hash the result. If you read data from the system time, line in, application window positions, register states, mouse position, memory status etc then hash them with md5 you'll get a damn unpredictable number.   ;Quote:Original post by GrainWhat about sampling the soundcards mic or line-in. there should always be some amount of white noise on it.Use /dev/random if your OS has it. Soundcard input noise varies unpredictably.As for devices to create random data: There was one Intel Chipset that included a random data source. Another possibility is a webcam (just use the noise of the sensor when the objective is closed).   ;Quote:Original post by GrainWhat about sampling the soundcards mic or line-in. there should always be some amount of white noise on it.Yes. See, for example, http://linux.about.com/od/commands/l/blcmdl4_random.htm   ;  hardware solutions are found at, for example, http://random.com.hr/products/hg400/index.html and http://comscire.com/Home/   ;  If you want a better pseudorandom number generator, I'd suggest looking at the Mersenne Twister.   