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.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top