Reimplement Random Number Generation (RNG) for fairness

By now you’ve finished the core Skillz implementation and all the major components are in place to give your game multiplayer gameplay capabilities. it’s time to make sure your players’ games are fair and everyone is on a level playing field.

Note, not all games will require this step, but if your gameplay is affected by random number generation or from external factors, like items or in-app purchases, outside of the current tournament we recommend that you follow the steps below.

 

Step 1: Implement consistent random number generation

Random numbers can be essential to many different types of games. However, it also causes fairness concerns when playing in Skillz tournaments. In order to address the potential imbalance caused by random numbers, the Skillz API offers the methodsSkillzGetRandomNumber and SkillzGetRandomNumberInRange. SkillzGetRandomNumber returns a pseudo random number between 0 and RAND_MAX, and SkillzGetRandomNumberInRange lets you specify your own range. The numbers returned by the Skillz random methods are in the same sequence for each player in a match.

Here is an example of using SkillzGetRandomNumber:

if (SkillzTournamentIsInProgress()) {
    return SkillzGetRandomNumber();
} else {
    return random();
}

Please be aware that just because you use either of the Skillz random methods does not guarantee that all players will have an identical game experience. These methods can only ensure that players get the same sequence of random numbers. Over time the player’s decisions may diverge and the same random number will not be used in the same place.

There may be places where the random decision is trivial to the outcome of the game, or purely aesthetic; in that case we recommend you do not use the Skillz random methods. Due to the sequential nature of the Skillz random methods, it’s best to apply them conservatively to reduce the chances of making a different number of calls between players. Additionally we suggest avoiding the the C function rand() in your application to avoid conflicts with the Skillz random methods.

 

Step 2: Ensure players cannot obtain advantages from outside the game

With the potential for real money to be awarded to one player or another, we’ll need to be certain that players won’t have any edge based on factors outside the tournament they are playing. Examples of this include items obtained from in-app purchases or bonuses gained from playing in single-player mode. This is highly specific to each individual game, but if there are any ways for players to obtain in-game bonuses these should be disabled when playing with Skillz.