Discuss Scratch

shadowspear1
Scratcher
38 posts

Percentage Occurance

Hello, I may just be having a temporary brain shortage, but I want to find out how to script this:
~ With a _% chance, do (something)

I've tried to use pick random blocks, but the percentage goes up exponentially when you try it. For example:
~ if <(pick random (90) to (100) = (100))> then
~ this will only have a 10% chance of happening, rather than 90% ( because it is picking

~ if <(pick random (95) to (100) = (100))> then
~ this will have a 20% chance of occurring

…and so on.

Any help would be appreciated


I've been here for: 1.3, 1.4, ehh skip a few, 2.0! I love cloning.
Have a good day
drmcw
Scratcher
1000+ posts

Percentage Occurance

if <(pick random (0) to (99)) < (%chance)>
say [Bingo!] // do it
else
say [Bad luck] // don't do it
end

Last edited by drmcw (Oct. 24, 2013 05:35:41)


10 !
ScratchVaders or Galaga?
Maybe Eliza can help you decide?
shadowspear1
Scratcher
38 posts

Percentage Occurance

drmcw wrote:

if <(pick random (0) to (99)) < (%chance)>
say [Bingo!] // do it
else
say [Bad luck] // don't do it
end
Thank you so much! After a long sleep, I think my brain should be healed of its incapabilities now xD


I've been here for: 1.3, 1.4, ehh skip a few, 2.0! I love cloning.
Have a good day

Powered by DjangoBB