A code where you can make something rare

For context: I’m making a game similar to BitLife (but it’s more based on a specific country), and I want to make it so if you’re born in the capital, there’s a 10% chance of that happening. Does anyone know how to do this? If so, I’m guessing you’ll need:
Block

<(pick random (1) to (10)) = (1)>, or <(pick random (0) to (1.0)) \<= (0.1)> if you want more precise control over the threshold (say, 0.15)

Thank you! I’m curious as to how I would put this in a code. And what would a 50% one look like?

for 50%, you can use the second option i gave, and change the right side of the <[] \<= []> to be 0.5, since 50% in percentage form is 0.5 in decimal form. a good way to know what a percentage is equal to is by dividing by 100, so 10% = 0.1, 50% = 0.5, 100% = 1.

you’ll have to make it yourself, since i didn’t feel like using script pics. to get the <[] \<= []>, you can grab a <[] \< []> block, right-click it (or tap the touchpad with 2 fingers), click Relabel, and you’ll see this menu:


select the one at the top, and you’ll have the less-than-equal-to block.

That’s okay :+1: thank you

I made a block if you want it:
Random Percentage

BTW it supports decimals

Thanks! :^D

I think you can do it without the loop, but you might want to double check to make sure it works:

why not just
untitled script pic (57)
?

I don’t know why not :D
yours is way better of course, i forgot about the 1.0 thing!

why not just
untitled script pic (14)
?

“I don’t know why not :D
yours is a bit better of course, i forgot about the 1.0 100.0 thing!”

I was going to say that!! ]:<

i saw that lol