| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Random numbers |
Fernando, 01 Aug you wrote to All:
FAG> Is it true that this piece of code:
FAG> randomize();
FAG> int a=random(0);
FAG> may generate a "Divide error"??
Yes, a simple implementation of random() could be:
int random(int sides) {
return rand()%sides + 1;
}
Bye,
Erik
---
---------------
* Origin: WarmelinkE@vertis.nl (2:282/1.60) |
|
| 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™.