Good coin toss code

ThySpektre

TH.net Regular
Reaction score
10
Hello all.

I need a 50% probability generator.

Right now I am using:

(Random integer number between 1 and 2) Equal to 1

and I am getting a LOT more 1's that 2's

Ideas?

ThySpektre
 

AgentPaper

From the depths, I come.
Reaction score
107
Try random integer between 1 and 100 is less than 50, and are you using test map to try it? make sure to have random seed on if you are (otherwise all your randoms will be...not random)
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
> (Random integer number between 1 and 2) Equal to 1
> and I am getting a LOT more 1's that 2's

Sounds random to me.

In 10 tries, "1111111111" is just as likely as "1212121212"...
 

xPheRe

New Member
Reaction score
43
Even if you try a thousand times getting a random number between 1 and 2 and all you get are 1's, you can't say this isn't random...
Just that you had bad luck (if you need a 2) :D
 

Grundy

Ultra Cool Member
Reaction score
35
AceHart said:
> (Random integer number between 1 and 2) Equal to 1
> and I am getting a LOT more 1's that 2's

Sounds random to me.

In 10 tries, "1111111111" is just as likely as "1212121212"...
yea it is just as likely as 1212121212 but it is no where near as likely as all the other possiblities you could have. if you want to say what number in what order then they all have the same chances, but if you're talking about total 1s and total 2s then it is no where near the same. your chances of getting all 1s in 10 tries is 0.09765625%
you have 102.4 times more chances of getting anything other than all 1s and ther are only 10 other possiblities. each one is NOT just as likely as getting all 1s
 

ThySpektre

TH.net Regular
Reaction score
10
LOL, Thanks Grundy.

I have a degree in advanced mathematics and was wondering where the previous replies were coming from LOL...

Acehart and xPheRe I'd like to play some poker with you guys :cool:

ThySpektre

AgentPaper, I'll try your suggestion and I see the same behaviour in test (with the random seed thing unchecked, and in Bnet)

Grundy said:
yea it is just as likely as 1212121212 but it is no where near as likely as all the other possiblities you could have. if you want to say what number in what order then they all have the same chances, but if you're talking about total 1s and total 2s then it is no where near the same. your chances of getting all 1s in 10 tries is 0.9765625%
you have 102.4 times more chances of getting anything other than all 1s and ther are only 10 other possiblities. each one is NOT just as likely as getting all 1s
 

xPheRe

New Member
Reaction score
43
Grundy said:
(...) your chances of getting all 1s in 10 tries is 0.09765625%(...)
LOL! If this isn't bad luck... :D

I was talking about randomness, not about how many 1's and 2's you can count in 10 tries.
1111111111 sounds to me as random as 1211212212, even being less probable.

ThySpektre said:
Acehart and xPheRe I'd like to play some poker with you guys
LOL! Maybe you know now why I don't play poker :D
 

ThySpektre

TH.net Regular
Reaction score
10
Yes,

So whereas you cannot PROVE 10 1's in a row are not random (you also cannot prove they are) without knowing the algorithms guts, you CAN say with ever increasing PROBABILITY that it is not.

I'm an engineer at heart...<0.1% chance is good enough experimentation for me! :)

If I wax philosophical, I do not believe in ANY randomness in the universe...I simply want a better approximation of it here.

ThySpektre


AceHart said:
Hm...

Random has no history.
Neither is it supposed to meet your expectations.
 
S

skyrider123

Guest
yeah just sounds like you had a bit of bad luck there man lol.
 

the Lumpy

►►►
Reaction score
53
Could it be that since it is a random integer it actually takes a random real number and converts it to an integer? Because I think conversion to an integer just drops the decimal part and doesn't round the number (i.e. 1.99 converted to an integer = 1).
Please correct me if I'm wrong. :D
 

DDRtists

ɹoʇɐɹǝpoɯ ɹǝdns
Reaction score
415
ThySpektre said:
LOL, Thanks Grundy.

I have a degree in advanced mathematics and was wondering where the previous replies were coming from LOL...

how old are you :eek:
 

mase

____ ___ ____ __
Reaction score
154
Im 15 too...
 

Sargon

New Member
Reaction score
83
Back on topic.

I think there's something in the World Editor preferences relating to random stuff and Test Map. That might be affecting it, or you're just having a lucky (or unlucky, depending) streak.
 

ThySpektre

TH.net Regular
Reaction score
10
I had tried the flag to unlock the random seed in the WE to no avail.

Changing the code as AgentPaper suggested gave much better "randomness".

ThySpektre
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
> Changing the code as AgentPaper suggested gave much better "randomness".

Two guesses here:

1. You're happy with it. (important)
2. It's much less random than you think it is. (ignore this)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top