That means its a 1 out of 2 odd for either ran1 or ran2. Now I have a VERY ugly and wrong way of changing the odds. So ugly that I'm ashamed of posting it here. So how would I make it say... 1 in 20 chance of getting ran2?
Warning! I have not googled this yet so if you reply within the next 4 hours you are encouraging extreme laziness. ]
Yeah I noticed. But I don't think using an if else command is the right way to handle this and thats the only way I can think of to check it. I know it sounds right. I'll post my code later so you can see why I think it might be wrong. Is there another line to use other then if else?
mcreefer:
Its a 50/50 chance that it would pick ran2 for the value. I need it to be a 30/70 chance.
It's not a 50/50 chance, it will generate a random number between ran1 and ran2. Sounds like your looking for an if else statement based on a random something like if(random(0,99) < 30).
mcreefer: delay(random(ran1,ran2));That means its a 1 out of 2 odd for either ran1 or ran2.
Based on this quote, and others following, it looks like you expect this code to delay for either ran1 or ran2 milliseconds. That's not what it will do. It will select a random number between ran1 and ran2, and delay for that number of milliseconds. The probability density functions of these two calculations are quite different.
You'll have to select constants k and x to get the probabilities that you expect - either 1/20, or 70/30, depending on which of your posts I read. There's no direct "if" statement, but the "?:" construction is the moral equivalent. If you select 1 of n items completely at random, you have some other options, but if you want to explicitly define the probabilities, it looks like you're stuck with some kind of conditional.