Click here to Skip to main content
15,922,325 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow to run a application in safe mode also? Pin
rohit.dhamija30-Oct-03 20:25
rohit.dhamija30-Oct-03 20:25 
AnswerRe: How to run a application in safe mode also? Pin
Antti Keskinen1-Nov-03 11:22
Antti Keskinen1-Nov-03 11:22 
Questionhow to serialize file through HTTP?? Pin
xxhimanshu30-Oct-03 19:38
xxhimanshu30-Oct-03 19:38 
Questionhow to transfer data betwn two dialogs Pin
Rajesh match30-Oct-03 18:39
Rajesh match30-Oct-03 18:39 
AnswerRe: how to transfer data betwn two dialogs Pin
Michael P Butler30-Oct-03 22:11
Michael P Butler30-Oct-03 22:11 
AnswerRe: how to transfer data betwn two dialogs Pin
David Crow8-Jun-04 2:40
David Crow8-Jun-04 2:40 
QuestionHow can a self-extracting file get parameter from html ? Pin
suninwater30-Oct-03 18:24
suninwater30-Oct-03 18:24 
AnswerRe: How can a self-extracting file get parameter from html ? Pin
valikac31-Oct-03 5:22
valikac31-Oct-03 5:22 
GeneralDocking Windows Pin
monrobot1330-Oct-03 17:02
monrobot1330-Oct-03 17:02 
GeneralHelp about GetBitmapBits!!! Pin
twing30-Oct-03 16:07
twing30-Oct-03 16:07 
GeneralRe: Help about GetBitmapBits!!! Pin
Christian Graus30-Oct-03 16:18
protectorChristian Graus30-Oct-03 16:18 
GeneralRe: Help about GetBitmapBits!!! Pin
twing30-Oct-03 16:53
twing30-Oct-03 16:53 
GeneralRe: Help about GetBitmapBits!!! Pin
Christian Graus30-Oct-03 17:02
protectorChristian Graus30-Oct-03 17:02 
GeneralRe: Help about GetBitmapBits!!! Pin
twing30-Oct-03 17:25
twing30-Oct-03 17:25 
GeneralRe: Help about GetBitmapBits!!! Pin
Christian Graus30-Oct-03 17:27
protectorChristian Graus30-Oct-03 17:27 
QuestionHow to get network interface name of local machine? Pin
George230-Oct-03 15:15
George230-Oct-03 15:15 
AnswerRe: How to get network interface name of local machine? Pin
Alexander M.,30-Oct-03 22:15
Alexander M.,30-Oct-03 22:15 
QuestionDoes anyone have spare time and want to help me? Pin
Snyp30-Oct-03 14:43
Snyp30-Oct-03 14:43 
AnswerRe: Does anyone have spare time and want to help me? Pin
kotbegemot31-Oct-03 1:24
kotbegemot31-Oct-03 1:24 
AnswerRe: Does anyone have spare time and want to help me? Pin
Anonymous24-Dec-04 19:58
Anonymous24-Dec-04 19:58 
GeneralRandom number generator Pin
Snyp30-Oct-03 14:36
Snyp30-Oct-03 14:36 
GeneralRe: Random number generator Pin
alex.barylski30-Oct-03 15:51
alex.barylski30-Oct-03 15:51 
GeneralRe: Random number generator Pin
ZoogieZork30-Oct-03 15:54
ZoogieZork30-Oct-03 15:54 
It depends on how "random" you need your random numbers to be. The standard (ANSI C) rand() function should be random enough for most general-purpose applications, but on some platforms be aware that the lower-order bits may be much less random than the higher-order bits. AFAIK, most implementations of rand() use the "linear congruential formula":
http://www.taygeta.com/rwalks/node1.html[^]

Another random number generation algorithm is the Mersenne Twister:
http://www-personal.engin.umich.edu/~wagnerr/MersenneTwister.html[^]

Of course, the strongest random number generators are ones which use a random natural source rather than an algorithm. Under Linux, the /dev/random device collects entropy in the form of timings between hardware interrupts. The downside to these generators are the fact that you can quickly exhaust the supply of random bits from the source and thus have to wait while the device collects more data. Other potential natural sources of random bits are measurements of radioactive decay and even lava lamps (as implemented by a team at SGI, using the image data from a webcam pointed at the lamps). Smile | :)

For much more in-depth information about random number generation, see: "Numerical Recipes in C: The Art of Scientific Computing", particularly chapter 7 ("Random Numbers"). The authors go through a number of random number generation algorithms with varying randomness.

- Mike
GeneralRe: Random number generator Pin
Mike Dimmick31-Oct-03 6:14
Mike Dimmick31-Oct-03 6:14 
QuestionHow to create a slider control Pin
vhunghl30-Oct-03 14:07
vhunghl30-Oct-03 14:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.