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 SkillzRandom class. SkillzRandom has functions for integers including nextInt, and nextInt(min, max). There are also SkillzRandom methods for other data types, including nextBoolean, nextDouble, and nextBytes, among others.

The function nextInt returns a pseudo random number between 0 and RAND_MAX, while nextInt(min, max) lets you specify your own range (min inclusive, max exclusive). The numbers returned by the SkillzRandom methods are in the same sequence for each player in a match.

Here is an example of using SkillzRandom.getInt:

if (SkillzTournamentIsInProgress()) {
    return Skillz.getRandom().nextInt();
} 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 to reduce the chances of making a different number of calls between players.


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.


Step 3: Certify that you've tested for Fairness in your game

Using our Fairness tool you can certify that you've tested our Fairness (RNG) algorithm in your game. You'll be asked to upload some screenshots of one match from the perspective of both players, where you make the exact same moves for each player.


If Skillz Fairness has been properly implemented in your game, the screenshots should match as both players will have received the same sequence of events in their gameplay. If your game does not employ RNG, just take a screenshot at the beginning of each match and upload it to certify that your game is fair.

When you've tested fairness in your game, check the "do your screenshots match" checkbox, and then click the verify button to confirm that your game is fair.