www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/23/23:47:08

From: "Nathan Cournia" <nac2b AT frank DOT mtsu DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Random interger numbers
Date: 24 Mar 1998 04:31:32 GMT
Organization: Middle Tennessee State University
Lines: 11
Message-ID: <01bd56dd$5d636c80$0f02000a@frank.mtsu.edu.frank.mtsu.edu>
NNTP-Posting-Host: knuth.mtsu.edu
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

	How do I produce a random interger number between 0 and n.  Right now I'm
using the following code:

	return (((int)((double)rand()/(double)RAND_MAX))*n);

	Unfortunately this equation always produces the result of 0.  What I need
is a function that will act as a (n) sided dice.  Thanks for the help.

	Nathan


of bringing the cursor to the
>appropriate line of the appropriate file, Rhide seems to choose an
>arbitrary line in the file to jump to.  Then if I keep pressing F7/F8 it
>moves the cursor down, but it has already started from the wrong place.
Have you modified the source file since you've rebuilt?  Try recompiling
that file and re-linking
your exe.

Andy

- Raw text -


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