cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1999/09/01/03:19:20

From: Nate Eldredge <neldredge AT hmc DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Allegro and random numbers.
Date: Tue, 31 Aug 1999 19:37:04 -0700
Organization: Harvey Mudd College
Lines: 20
Message-ID: <37CC9150.2BFD0245@hmc.edu>
References: <7qhljj$245$3 AT news6 DOT svr DOT pol DOT co DOT uk>
NNTP-Posting-Host: mercury.st.hmc.edu
Mime-Version: 1.0
X-Trace: nntp1.interworld.net 936153443 2157 134.173.45.219 (1 Sep 1999 02:37:23 GMT)
X-Complaints-To: usenet AT nntp1 DOT interworld DOT net
NNTP-Posting-Date: 1 Sep 1999 02:37:23 GMT
X-Mailer: Mozilla 4.08 [en] (X11; I; Linux 2.2.12pre4 i586)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Tom Morton wrote:
> 
> Hello fellow human beings,
> 
> I'm writing a game with allegro and djgpp and it requires a random
> number generator that can have it's seed saved and changed. Until
> now I have been using the rand() and srand() functions but I need
> to be able to store the state of the random number generator.

You can do this with `random', it seems from the docs.  Look at
`initstate' and `setstate'.  Note that a glance at the source doesn't
convince me that this actually works.

Otherwise, you could take `rand' from DJGPP's source (unless you plan to
sell this commercially without source); it should be obvious how to save
and restore its state (the state is a single variable).  
-- 

Nate Eldredge
neldredge AT hmc DOT edu

- Raw text -


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