delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/05/22/17:45:27

From: Jason Cain <jcain AT SPAM DOT ti DOT com DOT SUCKS>
Newsgroups: comp.os.msdos.djgpp
Subject: Random numbers in a certain range?
Date: Fri, 22 May 1998 16:26:38 -0500
Organization: I hate spam!
Lines: 17
Message-ID: <3565ED8E.18DE01B6@SPAM.ti.com.SUCKS>
NNTP-Posting-Host: huy.de.sc.ti.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hello, 

I'm trying to find a way to generate random numbers within a given
range.  I want to generate a series of random points to draw on the
screen, and so in my case I need to generate random numbers from 0...640
and 0...480.  The way I understand it, the rand() function returns an
integer between 0 and the largest integer available on the system. 
Clearly most of these numbers will be too big for my purposes.  Any
suggestions?  Is there a function for this already, or will I have to
write my own?

Thanks in advance,

Jason Cain

NOTE:  To reply by email, remove the SPAM. and .SUCKS parts.  Stupid
spammers!

- Raw text -


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