How can I give different random outputs "weight" so one happens more often than the others? #813
-
Hello! So, I know how to create a coin flip. I could write a shuffle, say, However, what if I had a coin that was weighted, such that it landed on "Heads" 90% of the time? I could brute force it, like So - is there a way to add weight to one side of the coin? Or to have certain random events occur with frequency ("The town is quiet today.") and others occur very rarely ("The town is overrun with dinosaurs!")? As I write this out, I think I might try creating random number tables instead of plain shuffles. As in, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Think of shuffles as a short-hand: a quick way to solve a common problem. If you want to make your solution more specific, then break out a bit more scripting. Storing a dice-roll and testing it is a great way to achieve what you want, and get all the control over the weights you need. |
Beta Was this translation helpful? Give feedback.
Think of shuffles as a short-hand: a quick way to solve a common problem. If you want to make your solution more specific, then break out a bit more scripting. Storing a dice-roll and testing it is a great way to achieve what you want, and get all the control over the weights you need.