TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: FERNANDO ARIEL GONT
from: TOM TORFS
date: 1997-08-16 14:18:00
subject: Random numbers

Fernando Ariel Gont wrote in a message to All:
 FAG> Is it true that this piece of code:
 FAG> randomize();
 FAG> int a=random(0);
 FAG> may generate a "Divide error"??
Since randomize() and random() are non-standard, it could do anything and get 
away with it :-) (damn, been reading too much comp.lang.c lately )
But yes, it is very possible for random() to cause a divide error, for 
example if it is implemented using the modulo operator (which is a lousy 
implementation because your random distribution of numbers is not kept 
intact).
Why would you want to do random(0) anyway ? Not very random, is it ? ;-)
greetz,
Tom
tomtorfs@mail.dma.be
--- timEd/2 1.10+
---------------
* Origin: 80X86 BBS 32-15-24.62.32 V.34/V.FC (24h/24h) (2:292/516)

SOURCE: echomail via exec-pc

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™.