Mail Archives: djgpp/1997/04/30/13:44:52
Alan Wilson (awilson AT wilshire DOT com) wrote:
: What is the best way to write code that generates random numbers? What is
: the code to generate Random numbers say from 1-100 or some number in C.
John Aldrich told you about the libc functions; if you were more
interested in algorithms to generate random numbers I'd suggest you get
(or rather, borrow) Knuth's Seminumerical Algorithms - The Art of Computer
Programming, Volume 2. Half the book is about random numbers, how to
generate them, how random they are, etc. Only get this if you are heavily
into mathematics, though!
You could, of course, also look at the source code for the rand[om]()
functions in libc.
--
George Foot <mert0407 AT sable DOT ox DOT ac DOT uk>
Merton College, Oxford
- Raw text -