Good coin toss code

xPheRe

New Member
Reaction score
43
It's hard to code a good balanced algorithm that return really random values.
Even more if you need a fast answer because the program do lots of consecutive calls to that algo.
Maybe Blizzard's one isn't accurate for small ranges.
 

ThySpektre

TH.net Regular
Reaction score
10
As mentioned above, I don't believe in true randomness. Especially from a fixed state machine. I just want a good approximation.

AceHart said:
> 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)
 

the Lumpy

►►►
Reaction score
53
the Lumpy said:
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
Could someone please confirm whether this is right? I would greatly appreciate it.

DDRtists said:
Ah im the young one here then :eek: Im 15 :D
I'm the young one. I'm 12. :D
 

uberfoop

~=Admiral Stukov=~
Reaction score
177
i guess if 1-2 doesnt work, you could do 1-100 and count anything less then (or equal to) 50 as 1 and anything over (or equal to) 51 as 2.
 

mase

____ ___ ____ __
Reaction score
154
uberfoop said:
i guess if 1-2 doesnt work, you could do 1-100 and count anything less then (or equal to) 50 as 1 and anything over (or equal to) 51 as 2.
This would have to be 1-101 to be even (or 1-11) (50/5 each)
 
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