# Skillz Random and Fairness

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 SDK has methods to generate random numbers; the numbers returned by Skillz are in the same sequence for each player in a match.

The Skillz random generator gives developers the means to ensure that each competitor in a match receives the exact sequence of

randomvalues to maintain fairness.

## API Methods

This lists the most commonly used methods. View the exhaustive list here.

- Unity/C#
- iOS/Swift
- iOS/Objective-c
- Android/Java

`SkillzCrossPlatform.Random.Value()`

##### Returns

A generated pseudo random float value

`SkillzCrossPlatform.Random.Range(float min, float max)`

##### Parameters

`min`

The minimum float value of the range

`max`

The maximum float value of the range

##### Returns

A generated pseudo random float value within the range given

The Random function

`Range(float min, float max)`

requires the min and max value range (max-min) to be no larger than`Float.MaxValue`

to prevent overflow.

`SkillzCrossPlatform.Random.Range(int min, int max)`

##### Parameters

`min`

The minimum int value of the range

`max`

The maximum int value of the range

##### Returns

An int value within the range given

The Random function

`Range(int min, int max)`

requires the min and max value range (max-min) to be no larger than`Int.MaxValue`

to prevent overflow.

`func getRandomNumber() -> Int`

##### Returns

A generated pseudo random `Int`

value

`func getRandomFloat() -> Float`

##### Returns

A generated pseudo random `Float`

value

`func getRandomNumber(withMin: UInt,`

andMax: UInt) -> UInt

##### Parameters

`withMin`

The minimum `UInt`

value of the range

`andMax`

The maximum `UInt`

value of the range

##### Returns

An unsigned integer `UInt`

value within the range given

`+ (NSInteger)getRandomNumber`

##### Returns

A generated pseudo random `NSInteger`

value

`+ (float)getRandomFloat`

##### Returns

A generated pseudo random `float`

value

`+ (NSUInteger)getRandomNumberWithMin: (NSUInteger)`

andMax: (NSUInteger)

##### Parameters

`getRandomNumberWithMin`

The minimum `NSInteger`

value of the range

`andMax`

The maximum `NSInteger`

value of the range

##### Returns

A pseudo random `NSInteger`

value within the range given

`Skillz.getRandom().nextInt()`

###### Returns

A generated pseudo random int value

`Skillz.getRandom().nextFloat()`

##### Returns

A generated pseudo random float value

`Skillz.getRandom().nextInt(int min, int max)`

##### Parameters

`min`

The minimum int value of the range

`max`

The maximum int value of the range

##### Returns

A generated pseudo random int value

`Skillz.getRandom().nextFloat(float min, float max)`

##### Parameters

`min`

The minimum float value of the range

`max`

The maximum float value of the range

##### Returns

A generated pseudo random float value

## Considerations

Please be aware that use 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.

Finally, it is vital that the developer consider the game flow for implementation of the Skillz random methods. Since this feature provides a single sequence of randomized numbers, a game which uses this functionality for *more than one* logical component may introduce a fairness issue. For example, in the case of an asynchronous game with a "bonus power" feature which is driven by the speed of the player, if those bonuses were determined by calls to getRandom(), they could occur at different points in gameplay between the players. This would then make the random sequence being used to drive the primary gameplay different between the players, potentially causing a serious issue in fairness. For that reason, a game using this mechanic would want to request enough random numbers to satisfy the theoretical maximum number needed for the bonuses before gameplay begins.

### Ensure Players Cannot Obtain Advantages from Outside the Game

With the potential for real money to be awarded to one player or another, 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.

### Utilizing Bots in Gameplay

Please note that in this context, "bots" refers specifically to the artificial intelligence (AI) developers use to create agents within the game experience that facilitate gameplay. All Skillz real-money games, without exception, are ones in which real players are in competition with other real players for prizes. Not an AI taking the place of a player, and not a re-use of a player score from an older game. When a cash game prize is won in Skillz, that prize goes to a genuine player.

As part of this commitment, it's imperative to ensure both fairness and player satisfaction, as well as maintain the integrity of the gameplay experience.

When integrating bots into your gameplay experience, consistency is key. A bot, by design, allows the computer to manage aspects of gameplay, typically acting as a player’s opponent and/or challenges. The bot behavior in your game must be deterministic, meaning that given the exact same set of player inputs and conditions, it must always produce the same bot behavior.

#### Skillz Gameplay Modes

Skillz offers two distinct gameplay modes: Real-time and Play-and-Compare.

##### Real-time mode

In this mode, bot opponents are only permitted:

- During the First Time User Experience, which consists of the mandatory Z tournaments a player goes through after a new install. The goal of synchronous bot opponents here is to educate the player on the game mechanics while also giving them an idea of the in-game experience.
- If the bots cannot impact fairness between the players. That is, there is no possibility that the bots may create an imbalance in difficulty or opportunity between the players. The goal of synchronous bot opponents here is to provide a more active game environment. And again, regardless of outcome, these bots will never be rewarded any real-world prizes.

##### Play-and-Compare mode

Given the asynchronous nature of this mode (where players "play and compare"), when bots are present players must face identical bots to ensure fairness. These bots are tailored to deliver consistent experiences.