delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/09/16:32:02

From: "Jo Voordeckers" <Jo DOT Voordeckers AT village DOT uunet DOT be>
Newsgroups: comp.os.msdos.djgpp
Subject: Using random numbers and Allegro
Date: Thu, 9 Apr 1998 20:08:41 +0200
Organization: UUNET Benelux (post does not reflect views of UUNET Benelux)
Lines: 25
Message-ID: <6gj3lt$ll9$2@xenon.inbe.net>
NNTP-Posting-Host: pool02a-194-7-47-53.uunet.be
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hi,

I'm trying to use 2 random numbers to put a sprite at a random place on the
screen, but the way I do it, it allways puts it on the same spot, I'm using
the DJGPP function
random() to get a random number but I use it this way to get the number to
be a maximum of 479 for x (respectively 399 for the y-value), well it's
kinda complicated to explain, I'm using this virtual screen (480x400 in
MODE-X 320x240) and use
-----------------------------------------
    x=fmod(random(),480);
-----------------------------------------
to get the appropriet x-value but it seems to allways give the same number
(I  use the same way to calculate the y-value)
I think it somehow has something to do with Allegro initializing stuff like
the timer-interrupt and such, I dunno actually...Can somebody tell me how to
do it right/faster/better?

--
Greeeetz,
         DJ SiGNAL
DJSiGNAL AT mail DOT dma DOT be
Please check out:  http://travel.to/dimension.x


- Raw text -


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