Weighted Random
Hi,
I'm not sure if this even the correct terminolog, being the complete newbie that I am. I think I've got a handle on how to create the random number that I want--thanks to the awesome video tutorials the members have been kind enough to put together.
My scenario is this......I have 5 dice, each being rolled 1 at a time. The first die outcome is completely random. I would like the second, third, and fourth to be somewhat random. By that I mean, the worse the outcome of the first die, would sort of penalize, by a small percentage, the chances of rolling a favorable second die. And if the second one is bad, the same odds would be in place for the third die, etc.
I've looked through the forums and can't seem to find anything, given my lack of GS knowledge, that steers me in the proper direction.
Thank you in advance for all of your help.
Dr. J
Comments
Can you explain what you mean by "favorable" and "worse" and "bad"? That is, can you give specific examples such as "Rolling a 1 or 2 is favorable while rolling a 3, 4, 5, or 6 is not"?
One way to make weighted "random" selections is to put all possible values in a table and then select a row using random(1,tableRowCount(tableName)). For example, a truly random selection would have a table (although you don't need a table for it) like this:
1 (17%)
2 (17%)
3 (17%)
4 (17%
5 (17%
6 (17%
While a weighted table might look something like this:
1 (10%)
2 (10%)
3 (20%)
3
4 (20%)
4
5 (20%)
5
6 (20%)
6
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Tatiang, thank you for getting back to me so soon. As I said, I am so very new to GS. My dice will have outcomes that are words, not numbers, so The only way I know how to do that so far is with tables.
In my first column, I am using it as Text to display the words. The "randomness" of the next die, I would like weighted by the outcome of the previous die. In the answer you gave, you are correct with my thinking; 1 is favorable, 2 is slightly less so, 3 is even more less so, and so on. Depending on the first die, the outcome of the second die, might be less favorable. And the outcome of the 2nd die, might be less or more favorable to the third die, etc.
So I'm not really sure I can fix set percentages to the second die itself, because the "randomness" of it depends on the previous roll. The way I'm picturing it is that each die has the same odds of rolling any of the six sides, like a normal die- with the additional weighting based on the roll of the previous die. God, I hope that makes sense to you. And again, thank you.
It makes sense. You need to come up with the math behind that system and then ask questions about setting it up in GameSalad. Or if you need help with the math, that might be possible, too, but you'll have to explain in great detail what "less favorable" really means... mathematically.
The table would be the same as I showed but your second column would be the text so that you're still using the first column for the percentage. Or perhaps you don't need a table; again it depends on the math behind what you're trying to do.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User