Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 959 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
using random() #478596
11/13/19 02:11
11/13/19 02:11
Joined: Aug 2019
Posts: 22
F
felixfx Offline OP
Newbie
felixfx  Offline OP
Newbie
F

Joined: Aug 2019
Posts: 22
hi, I'm testing the random number generator and I cannot seem to get random(1); to have an output other than zero.

I may be utilizing it incorrectly. The zorro.chm file saids

random(var max): var // suppose to return a number between 0 and max

my code looks like this:

function run()
{

int number = random(1);

if (number == 0) printf("\nZero");
if (number == 1) printf("\nOne");

}

Any ideas? Thanks!

Re: using random() [Re: felixfx] #478597
11/13/19 03:24
11/13/19 03:24
Joined: Aug 2019
Posts: 22
F
felixfx Offline OP
Newbie
felixfx  Offline OP
Newbie
F

Joined: Aug 2019
Posts: 22
also, i noticed that the argument to the random() function is supposed to be a var and returns a var, but if i use

var number = random(1); it returns no output, which i also find odd.

Re: using random() [Re: felixfx] #478598
11/13/19 04:17
11/13/19 04:17
Joined: Aug 2019
Posts: 22
F
felixfx Offline OP
Newbie
felixfx  Offline OP
Newbie
F

Joined: Aug 2019
Posts: 22
wow, i feel pretty dumb. the max argument means up to but not including. which means random(2) outputs 0 and 1.

Problem Solved


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1