Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by Zheka. 06/20/24 14:26
Lapsa's very own thread
by rki. 06/19/24 11:27
A simple game ...
by VoroneTZ. 06/18/24 10:50
Face player all the time ...
by bbn1982. 06/18/24 10:25
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 1,227 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mino, squik, AemStones, LucasJoshua, Baklazhan
19061 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Dice roll question #303510
12/29/09 13:20
12/29/09 13:20
Joined: Mar 2007
Posts: 112
MikeS Offline OP
Member
MikeS  Offline OP
Member

Joined: Mar 2007
Posts: 112
Hi guys, i need your help.

I need to do some dice rolls for my project.

i need 2D6 roll and 1D6 roll.

I actually use this code for it:

Code:
result = max(1,(min(int(random(7)),6)));// 1D6 roll

Hit_roll = max(2,(min(int(random(13)),12))); //2D6 roll


but my problem with this code is the following:

with this codes i have a much too high chance for the 1 (1D6 roll)
and for the 2 (2D6 roll)

maybe someone has a good sollution for this?

i want to have the same chances for each number

Greetings

Mike

Re: Dice roll question [Re: MikeS] #303511
12/29/09 13:25
12/29/09 13:25

M
mercuryus
Unregistered
mercuryus
Unregistered
M



result = integer(random(6))+1; // 1..6
Hit_roll = integer(random(11))+2; // 2..12


Re: Dice roll question [Re: ] #303518
12/29/09 15:44
12/29/09 15:44
Joined: Mar 2007
Posts: 112
MikeS Offline OP
Member
MikeS  Offline OP
Member

Joined: Mar 2007
Posts: 112
great, thank you, it worked.

Greetings Mike

Re: Dice roll question [Re: MikeS] #303527
12/29/09 18:08
12/29/09 18:08
Joined: May 2007
Posts: 2,043
Germany
Lukas Offline

Programmer
Lukas  Offline

Programmer

Joined: May 2007
Posts: 2,043
Germany
But actually, if you roll two dices, different numbers have a different propability.

Hit_roll = integer(random(6))+integer(random(6)+2;

This is like real dices.

Re: Dice roll question [Re: Lukas] #303539
12/29/09 19:48
12/29/09 19:48

M
mercuryus
Unregistered
mercuryus
Unregistered
M



lol


Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1