www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/04/30/13:44:52

From: mert0407 AT sable DOT ox DOT ac DOT uk (George Foot)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Random generator?
Date: 30 Apr 1997 10:29:20 GMT
Organization: Oxford University, England
Lines: 17
Message-ID: <5k76u0$j15@news.ox.ac.uk>
References: <2 DOT 2 DOT 32 DOT 19970429193847 DOT 006a0ec4 AT gate72>
NNTP-Posting-Host: sable.ox.ac.uk
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019