Home   Help Search Login Register  

Author Topic: Random function toping of at 25%  (Read 1069 times)

0 Members and 1 Guest are viewing this topic.

Mox2002

  • Guest
Random function toping of at 25%
« on: 11 Jul 2005, 15:55:17 »
I'm looking for a piece of code which -more or less- defaults the randomize
of 4 options to 25% each.

Currently I can't seem to get this to work.
Whichever Random command I try, I keep getting percentages around 33
or sometimes a LOT worse.
Certainly not anywhere near 25%.

I'd be happy if out of 10 or 20 retry's a percentage of around 25 would follow.

Plz help.

>>To be clear, this is NOT a request about how to use the Random-Function,
but maybe how to use it better then I can atm.

qqqqqq

  • Guest
Re:Random function toping of at 25%
« Reply #1 on: 11 Jul 2005, 16:21:51 »
Not tested.

_rand=random 3
? _rand < 0 : option0; exit
? _rand < 1 : option1; exit
? _rand < 2 : option2; exit
option3
exit


Offline Pilot

  • Contributing Member
  • **
Re:Random function toping of at 25%
« Reply #2 on: 11 Jul 2005, 16:28:03 »
Quote
? _rand < 0 :
I don't that that is right, unless my eyes are decieving me

try this instead:
_rand=random 4
?_rand > 3: option3; exit
?_rand > 2: option2; exit
?_rand > 1: option1; exit
option0
exit

Syntax not guarenteed

-Student Pilot

Offline Garcia

  • Members
  • *
  • Leeds United is the best football team...EVER!
Re:Random function toping of at 25%
« Reply #3 on: 11 Jul 2005, 16:29:36 »
Not tested.

_rand=random 3
? _rand < 0 : option0; exit
? _rand < 1 : option1; exit
? _rand < 2 : option2; exit
option3
exit



Won't work, cause if _rand is 2, then "? _rand < 1" will be true since _rand is more than 1...

something like this should work:

_random = random 100

? _random < 25 : goto "1"
? _random > 25 && _random < 50 : goto "2"
? _random > 50 && _random < 75 : goto "3"
goto "4"

Mox2002

  • Guest
Re:Random function toping of at 25%
« Reply #4 on: 11 Jul 2005, 17:14:07 »
Thanks a Bunch Everyone!

I too discovered that with numbers like around 100 the randomization
seems to improve upon 1-4 or so (at least a bit, or so it seems maybe).
However, I'm not completely satisfied because *duh* this sollution still doesn't prevent option %X from being selected 3 times in a row.

I guess that after all, all I wanted was a combination of a random selection
with a counter to prevent the same selection twice after eachother *sigh*.

I'm now running a first selection from 1 to 4 which then includes the randomization...guess that will have to do  :-\











Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Random function toping of at 25%
« Reply #5 on: 11 Jul 2005, 22:36:05 »
Quote
I'm not completely satisfied because *duh* this sollution still doesn't prevent option %X from being selected 3 times in a row.
You will never be able to prevent that unless you write it into the script.  At a 25% probability of selecting any one of four options then after making a selection there is a 6.25% probability that the next two selections will be the same.  This is between 2 and 3 times the probability of throwing a double six with two dice (2.8%).
« Last Edit: 11 Jul 2005, 22:36:49 by THobson »

qqqqqq

  • Guest
Re:Random function toping of at 25%
« Reply #6 on: 12 Jul 2005, 01:36:20 »
Quote
? _rand < 0 :
I don't that that is right, unless my eyes are decieving me

Yes I was wondering who'd be first to spot that. ::)