Register
Log In
Forums
Starting with Zorro
using random()
Forums
Calendar
Active Threads
Search
Forum Help
Gamestudio Links
► Features
► Download
► Online Tutorial
► Free Resources
Zorro Links
► Download
► Online Manual
► Online Tutorial
► Blog
► Support
► What's New?
Newest Posts
Alternative to Stooq for Zorro S
by jcl. 10/09/26 16:00
Stooq now requires an API key
by cwford. 10/08/26 23:27
♪♫♪ [For hire] VOLKOVSTUDIO - Music, SFX, Voice over, implementa
by Volkovstudio. 10/08/26 13:53
ZorroGPT
by TipmyPip. 10/06/26 05:32
Didn't Receive Subscription Key after Purchasing Zorro
by AndrewAMD. 10/05/26 16:36
Purchase A8 full licence version
by jcl. 10/05/26 12:12
Alice1 (Black Book) – missing weekend-open bars in H1, results c
by jcl. 10/05/26 12:02
Has anyone developed a turtle trading script?
by gbe. 10/03/26 14:42
AUM Magazine
Latest Screens
Who's Online Now
3 registered members (
JeyKey II
,
cwford
, 1 invisible), 17,889 guests, and 2 spiders.
Key:
Admin
,
Global Mod
,
Mod
Newest Members
JimSimons
,
julienp
,
julienper
,
KelleyAbbey
,
Yopachi
19246 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
OP
Newbie
felixfx
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
OP
Newbie
felixfx
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
OP
Newbie
felixfx
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
Hop To
Gamestudio ------
Starting with Gamestudio
Atari lite-C
Editors & Templates
A8 Engine
Shaders
Third Party Tools
Acknex Users Magazine
The Past
The Future
Zorro ------
Starting with Zorro
Educational
Automated Trading
Zorro Scripts
RangerZ & Z Systems
Zorro and the Brokers
Zorro Future
Feedback ------
Bug Hunt
Blame the Manual
Ask the Developers
Updates & Announcements
Rants
Game Creation ------
Game Design & Business
Jobs Wanted
Jobs Offered
User Resources
Projects
Showcase
Beyond Games & Money ------
Hilbert's Hotel
Morbius' Virtual Answering Machine
Print Thread
Switch to Threaded Mode
5
Excellent
4
Good
3
Average
2
Bad
1
Terrible
View Profile
Send Private Message
Follow User
Show Forum Posts
View Profile
Send Private Message
Follow User
Show Forum Posts
View Profile
Send Private Message
Follow User
Show Forum Posts
Default Style
gamestudio
UBBT77
UBBT77 - Dark2
Forum Rules
·
Mark All Read
·
Powered by UBB.threads™ PHP Forum Software 7.7.1