Register
Log In
Forums
Starting with Zorro
using random()
Forums
Calendar
Active Threads
Search
Forum Help
Gamestudio Links
► Features
► Download
► Online Manual
► Online Tutorial
► Free Resources
► F.A.Q.
Zorro Links
► Download
► Online Manual
► Online Tutorial
► Blog
► Support
► What's New?
Newest Posts
Seeking Advice: Trading Two Algorithms for SPX500 / US Treasury
by AndrewAMD. 05/07/24 00:56
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Zorro Mistakenly Changes Another Assets Parameter in Loop
by dr_panther. 05/06/24 18:24
tradeUpdatePool() but for only exiting positions
by AndrewAMD. 05/03/24 15:20
FOSS C++ DLL framework with a Python subsystem and git hooks.
by firatv. 05/02/24 09:40
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Texture/Sprite animation tool. Someone interested in ?
by NeoDumont. 04/29/24 02:20
AUM Magazine
Latest Screens
Who's Online Now
2 registered members (
AndrewAMD
,
ChrstphFr
), 941 guests, and 4 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
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
The 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