Random Number Generator

Generating result...

Settings

Count:
Repetition
Min value:
Max value:

Understanding Random Number Generation

What is a Random Number Generator?

A Random Number Generator (RNG) is a device or algorithm that produces a sequence of numbers or symbols that cannot be reasonably predicted better than by random chance.

Mathematical Definition

For a given range \([a, b]\), a random number \(X\) is generated as:

\[X = a + (b - a) \cdot R\]

Where \(R\) is a random value between 0 and 1.

Calculation Method

  1. Generate a random value \(R\) between 0 and 1
  2. Calculate the range width: \(w = b - a\)
  3. Multiply \(R\) by \(w\)
  4. Add the minimum value \(a\) to the result
  5. Round to the specified number of decimal places

Example Calculation

Let's generate a random number between 10 and 20 with 2 decimal places:

  1. Let \(R = 0.7532\) (randomly generated)
  2. \(w = 20 - 10 = 10\)
  3. \(10 \cdot 0.7532 = 7.532\)
  4. \(10 + 7.532 = 17.532\)
  5. Rounded to 2 decimal places: 17.53

Visual Representation

10 20 17.53

This diagram represents the randomly generated number 17.53 within the range of 10 to 20.