MiniTon WhitePaper
  • πŸ†Welcome to MiniTon
  • ❔Why Now and Why MiniTon
  • About MiniTon
    • πŸ’΅Social Esports: Flexible and Compatible
      • Entry Fee
      • Prize
      • Types of Tournaments
      • Match Rules
    • πŸ•ΉοΈCompetitive Gaming Platform
      • Discover and Indulge in Captivating Games
      • Ensuring Game Fairness in Every Social Esports Encounter
      • Empowering Every Player to Organize Tournaments
    • πŸͺ„Developer Solution
    • πŸ“ˆSustainable Business Model
    • πŸ’²Tokenomic $MTC
    • πŸ§—β€β™‚οΈRoadmap
  • BUILDERS
    • πŸ’―Initial Team
    • 🎭Community
    • 🧩DAO Governance
  • Developer Success
    • πŸ‘¨β€πŸ’»MiniTon Developer Documentation
      • Set Up Core Loop & Gameplay
      • Random and Fairness
      • Setting up Tournaments and Gameplay Parameters
      • Implement Progression
      • Automatic Difficulty
      • Crash Detection via Crashlytics
      • Anti-Cheating Techniques
      • Aborted Matches and Forfeits
      • API-reference
    • 🀝Developer Cooperation
      • Is your game a game of skill?
      • Go Live with MiniTon
      • Game Marketing Guidelines
      • Tutorial Best Practices
      • Unlock Real Prizes
    • βš™οΈMiniTon Gaming SDK
      • Introduction
      • Initialize and load your game
      • Start your game until end
      • Reporting Game Data API
      • How to verify your signature
  • Legality
    • πŸ›οΈThe Legality of MiniTon
    • πŸ”’Privacy Policy
    • ⚠️User Terms & Conditions
Powered by GitBook

Contact us

  • Telegram

©️MiniTon 2023

On this page
  • API Methods
  • Considerations
  • Ensure Players Cannot Obtain Advantages from Outside the Game

Was this helpful?

  1. Developer Success
  2. MiniTon Developer Documentation

Random and Fairness

PreviousSet Up Core Loop & GameplayNextSetting up Tournaments and Gameplay Parameters

Last updated 1 year ago

Was this helpful?

Random numbers can be essential to many different types of games. However, it also causes fairness concerns when playing in MiniTon tournaments. In order to address the potential imbalance caused by random numbers, the MiniTon SDK has methods to generate random numbers; the numbers returned by MiniTon are in the same sequence for each player in a match.

The MiniTon random generator ensures that each competitor in a match receives the exact sequence of random values to maintain fairness.

API Methods

This lists the most commonly used methods. .

MiniTonCrossPlatform.Random.Value()

Returns

A generated pseudo random float value


MiniTonCrossPlatform.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.


MiniTonCrossPlatform.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.

To provide the equivalent functionality in JavaScript for generating a pseudo-random float value using MiniTonCrossPlatform.Random.Value(), you can use the following JavaScript code:

// Assuming you have a MiniTonCrossPlatform object initialized with a Random module
// This function returns a generated pseudo-random float value between 0 (inclusive) and 1 (exclusive)
function getRandomFloat() {
    return MiniTonCrossPlatform.Random.Value();
}

// Usage example
const randomValue = getRandomFloat();
console.log("Random Float Value:", randomValue);

The getRandomFloat function returns a pseudo-random float value, and you can use it in your game as needed. The code generates a float value between 0 (inclusive) and 1 (exclusive).


To provide the equivalent functionality in JavaScript for generating a pseudo-random float value within a specified range using MiniTonCrossPlatform.Random.Range(min, max), you can use the following JavaScript code:

// Assuming you have a MiniTonCrossPlatform object initialized with a Random module
// This function generates a pseudo-random float value within the specified range [min, max)
function getRandomFloatInRange(min, max) {
    if (max - min > Number.MAX_VALUE) {
        console.warn("Range too large. Maximum allowed range is Number.MAX_VALUE.");
        return null; // Handle the error as needed
    }

    return min + (max - min) * Math.random();
}

// Parameters
const min = 0.0; // Replace with your desired minimum value
const max = 1.0; // Replace with your desired maximum value

// Usage example
const randomValueInRange = getRandomFloatInRange(min, max);
console.log("Random Float Value in Range:", randomValueInRange);

In this JavaScript version, you should have a MiniTonCrossPlatform object initialized with a Random module. The getRandomFloatInRange function generates a pseudo-random float value within the specified range [min, max). It also includes a check to ensure that the range does not exceed the maximum allowed value to prevent overflow, as mentioned in your documentation.

You can customize the min and max parameters according to your desired range, and the randomValueInRange variable will hold the generated random float value within that range.


To provide the equivalent functionality in JavaScript for generating a pseudo-random integer value within a specified range using MiniTonCrossPlatform.Random.Range(min, max) with integer parameters, you can use the following JavaScript code:

// Assuming you have a MiniTonCrossPlatform object initialized with a Random module
// This function generates a pseudo-random integer value within the specified range [min, max]
function getRandomIntInRange(min, max) {
    if (max - min > Number.MAX_SAFE_INTEGER) {
        console.warn("Range too large. Maximum allowed range is Number.MAX_SAFE_INTEGER.");
        return null; // Handle the error as needed
    }

    // Generate a random integer within the range [min, max]
    return Math.floor(Math.random() * (max - min + 1)) + min;
}

// Parameters
const min = 0; // Replace with your desired minimum value
const max = 100; // Replace with your desired maximum value

// Usage example
const randomIntInRange = getRandomIntInRange(min, max);
console.log("Random Integer Value in Range:", randomIntInRange);

In this JavaScript version, you should have a MiniTonCrossPlatform object initialized with a Random module. The getRandomIntInRange function generates a pseudo-random integer value within the specified range [min, max]. It includes a check to ensure that the range does not exceed the maximum allowed safe integer value to prevent overflow, as mentioned in your documentation.

You can customize the min and max parameters according to your desired integer range, and the randomIntInRange variable will hold the generated random integer value within that range.

Considerations

Please be aware that use of the MiniTon 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 MiniTon random methods to reduce the chances of making a different number of calls between players.

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 MiniTon.

πŸ‘¨β€πŸ’»
View the exhaustive list here