TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: ..Anybody..
from: Gautam Lad
date: 1996-02-25 20:43:36
subject: RAND()

Hi,

I am trying to create a program, where a random number is generated.
I have tried 'rand()' (and srand, etc.), but they only gives me positive integers.  

What I want is a positive floating point number (eg. 0.32, 0.93, 1.00,
0.99, 0.21...etc.)  

The number I want has to be less than or equal to 1.00 and the number
cannot be 0.00 ( later, if I want to , I can change the limit of the
number, lets say from 1.00 to 1.50). 

I want 2 decimal places after the decimal and 1 number before the decimal
(2 numbers before the decimal for another variable).

This question is related to Borland Turbo C++ v1.0 for DOS.

I have asked my friend, and he told me there's a special formula for this.
He doesn't know it, so could please someone please answer my question,
please!

THANKS! 

--- Maximus/2 3.00
* Origin: One Less Car * TorontOS/2 * (416) 480-0147 * (1:250/238)
SEEN-BY: 50/99 78/0 270/101 620/243 711/401 409 410 413 430 808 809 934 955
SEEN-BY: 712/407 515 517 628 713/888 800/1 7877/2809
@PATH: 250/238 12/98 12 3615/50 396/1 270/101 712/515 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.