### Swayed Random Number Generation

A swayed goal system is a method of producing random results that more closely follow what people believe is a truly random distribution. When people see a set of randomly produced numbers they are quick to point out streaks or patterns they perceive as sections where the random number generator has broken down. These perceived patterns in combination with with the fairly common knowledge that most number generators aren't truly random leads people to believe that the quality of the random data they are receiving is flawed.

In fact, although no system used in today's gaming market is truly random, people do not usually have the capacity to see the flaws in the numbers produced. When they see a perfectly normal streak of numbers in a randomly generated set, their first response is to feel cheated. (note I say cheated as players who get a good pattern feel lucky and have no complaints about the system) A swayed goal system actually reduces the random elements of the system and yet produces data that looks far more random to a player.

The Math

*ModChance = GoalChance / SwayVarSwayVar = SwayVar – ( GoalChance – SuccessVar ) * SwayPotency*

*ModChance* – This is the modified success rate that is checked.*GoalChance* – This is the target success rate.*SwayVar* – This bends the chance of the next success away from how far off of statistical chance it has been previously.*SwayPotency* – This is how much the swayed goal system will interfere with standard statical chance.*SuccessVar* – This is a 1 if the attempt was a success and a 0 if it was a failure.

How It Works

When the system starts, *SwayVar* is always 1, as it has not been modified by previous success or failure yet. As you do more and more attempts and fail, *SwayVar* keeps decreasing by the *GoalChance*, increasing the chance of future successes. If you ever get a success, *SwayVar* increases by the *SuccessVar *(1)*.* This resets the chance of success in the system. The end result of this is that with a 20% goal rate, it is basically impossible to not get a 20% success rate in a set of 5 attempts. No more streaks of 3 successes followed by 15 failures. *SwayPotency* modifies both the amount subtracted and the amount added for success by a set percentage, allowing you to decrease the potency and increase the randomness of the system.

One final note for implementation. This system will regularly give you *SuccessVar* values over 1. This can not only nullify some of the streak based benefits of the system but will also push your average rate of success slightly above the GoalChance. Simply temporarily reducing the GoalChance to 0 while the SuccessVar is over 1.

Results

I made a little demo program to show the advantages of this system. We will be examining final success rate over 100 attempts and the longest streak of failure. This is done with a *SwayPotency* of 1 and a *GoalChance* of 20%.

Regular Rate .20 - .19 - .21 - .13 - .19

Swayed Rate .20 - .20 - .20 - .20 - .20

Regular Streak 13 - 10 - 18 - 12 - 13

Swayed Streak 08 - 08 - 07 - 06 - 06

As you can see, not only does the Swayed Rate hit closer to our *GoalChance*, but the Swayed Streak is significantly lower. Now a sharp player may look at our swayed numbers and realize that they are too regular. Because of this we have included the *SwayPotency*. Lets see the same setup with a *SwayPotency* of 20%.

Regular Rate .20 - .19 - .12 - .15 - .17

Swayed Rate .19 - .20 - .19 - .20 - .19

Regular Streak 12 - 16 - 20 - 16 - 13

Swayed Streak 10 - 09 - 09 - 9 - 09

Now we see a bit more variation, yet still are hitting closer to our goal with significantly less streaks. The *SwayPotency* can be tweaked to allow for the most streak control while still appearing to be a truly random system.

This is a powerful tool for game design but how would one go about using it and what pitfalls should they worry about when using it? I will get into those issues in my next posting.

## 0 Comments:

Post a Comment

<< Home