Asad Abbas wrote: > Hi All, > > Manny languages like C++ provides a way to generate random numbers. > Like C++ provides a rand(); function to do this. > > But (it might be silly to ask) the code written behind these functions always > ramains the same in all cases and obviously it is coded by humanbeings, then > how > the output is different all the time (a random number)? > > And if it is a random number then with respect to whom it is generated? > And how can we say that a series of number generated are actually random > numbers? > > I dont know how the experts take this question, but it was in mind and i ask > it. > Treat it as beginner's question. > > Regards, > Asad Abbas > UET Taxila > Islamabad > Pakistan
Functions like srand() and rand() are almost always PRNGs: http://en.wikipedia.org/wiki/Pseudorandom_number_generator These only generate sequences that appear random but they do eventually repeat. Mersenne Twister is currently the best known PRNG. Cryptographically secure PRNGs are much harder to create and generally introduce additional entropy through more dynamic systems such as mouse cursor movement, network traffic, etc. True random number generators are available too via radioactive decay sources or atmospheric noise. Example: http://www.random.org/ -- Thomas Hruska CubicleSoft President Ph: 517-803-4197 *NEW* MyTaskFocus 1.1 Get on task. Stay on task. http://www.CubicleSoft.com/MyTaskFocus/
