Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Percentage Occurance
- 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
~ 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
- 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)
- Discussion Forums
- » Help with Scripts
- » Percentage Occurance