# Random number generator (seeded)

> Generate random numbers from a seed: integers in a range, decimals, lottery-style draws without repeats and dice rolls, repeatable with xoshiro256**.

انٹرایکٹو صورت: https://www.calcopenly.com/ur/statistics/random-number-generator
موضوع: شماریات اور احتمال کے کیلکولیٹر

Numbers come from xoshiro256**, a 64-bit pseudorandom generator by Blackman and Vigna with a period of 2²⁵⁶ − 1, whose starting state is filled from your seed by SplitMix64. Each 64-bit output x becomes min + (x mod m), where m is the number of possible values, after outputs from the top sliver of the 64-bit range are thrown away so that every value is exactly equally likely. Decimals are drawn as whole numbers of 10⁻ᵈ steps and divided back.

The default draws 10 integers from 1 to 100 with seed 2026: 10, 13, 19, 87, 95, 37, 73, 40, 32, 34. Anyone who enters the same seed and settings gets the same list, so raffle draws, classroom samples and simulations can be checked afterwards.

A seed-driven list is predictable to anyone who knows or guesses the seed, so it is unsuitable for passwords, encryption keys or prize draws where the seed is not published in advance.

## اندراجات

- **Generate** (اختیارات: Integers, Decimals, Dice rolls)
- **سے**
- **میں**
- **How many**
- **Decimal places**
- **No repeats**: Draw without replacement, like lottery numbers.
- **Sort the results**
- **Number of dice**
- **Sides per die**
- **Seed**: Same seed, same numbers. Change it for a new draw. A fresh unseeded draw from the browser's secure random source is not part of this calculation.

## نتائج

- نتائج — بنیادی نتیجہ
- Sum
- Mean
- Smallest
- Largest

## فارمولا

$$
\begin{gathered} v = \text{min} + (x \bmod m),\quad m = \text{max} - \text{min} + 1 \\ \text{keeping only } x < \left\lfloor 2^{64}/m \right\rfloor m \end{gathered}
$$

## حل شدہ مثالیں

### Ten integers 1–100, seed 2026 (defaults)

- Generate: Integers
- سے: 1
- میں: 100
- How many: 10
- Seed: 2026
- **نتائج: 10, 13, 19, 87, 95, 37, 73, 40, 32, 34**
- **Sum: 440**
- **Smallest: 10**
- **Largest: 95**
- جانچ کا ماخذ: ⁨Independent Python transcription of Vigna's splitmix64.c and xoshiro256starstar.c with the same rejection mapping (scratch script; its SplitMix64 matches the published seed-0 value 0xE220A8397B1DCDAF)⁩

### Lottery: 6 of 49, no repeats, sorted

- Generate: Integers
- سے: 1
- میں: 49
- How many: 6
- No repeats: ہاں
- Sort the results: ہاں
- Seed: 2026
- **نتائج: 11, 12, 18, 37, 40, 45**
- **Sum: 163**
- جانچ کا ماخذ: ⁨Same Python reference implementation⁩

### Five decimals in [0, 1] to 3 places

- Generate: Decimals
- سے: 0
- میں: 1
- How many: 5
- Decimal places: 3
- Seed: 2026
- **نتائج: 0.683, 0.143, 0.793, 0.253, 0.375**
- **Sum: 2.247**
- جانچ کا ماخذ: ⁨Same Python reference implementation (integer draw in [0, 1000], divided by 10³)⁩

### 3d6 with a text seed

- Generate: Dice rolls
- Number of dice: 3
- Sides per die: 6
- Seed: hello
- **نتائج: 1, 6, 1**
- **Sum: 8**
- جانچ کا ماخذ: ⁨Python reference; the text seed hashes to FNV-1a 64 0xa430d84680aabd0b, the published FNV-1a hash of “hello”⁩

### Edge case: a range of one value

- Generate: Integers
- سے: 1
- میں: 1
- How many: 3
- Seed: 7
- **نتائج: 1, 1, 1**
- **Sum: 3**
- جانچ کا ماخذ: ⁨With m = 1 every draw maps to the minimum⁩

### Edge case: all 5 values without repeats

- Generate: Integers
- سے: 1
- میں: 5
- How many: 5
- No repeats: ہاں
- Seed: 2026
- **نتائج: 5, 3, 4, 2, 1**
- **Sum: 15**
- جانچ کا ماخذ: ⁨Python reference: a full permutation of 1–5⁩

## سوالات

### Are these random numbers truly random?

No, they are pseudorandom: a fixed calculation turns the seed into a sequence that looks random but repeats exactly for the same seed. That suits games, sampling and simulation. Passwords and keys need a cryptographically secure generator, such as the browser's crypto.getRandomValues or a deterministic random bit generator specified in NIST SP 800-90A, which an observer cannot predict from past outputs.

### What does the seed do?

The seed sets the generator's starting state, so the same seed and settings always give the same numbers on any device. A whole-number seed from 0 to 18,446,744,073,709,551,615 (2⁶⁴ − 1) is used directly; any other text is hashed with 64-bit FNV-1a. For example, 3 six-sided dice with the seed hello always roll 1, 6, 1.

### How do I draw lottery numbers without repeats?

Set the range to 1–49, How many to 6 and turn on No repeats; a duplicate is redrawn until 6 different numbers remain. Each of the C(49, 6) = 13,983,816 possible sets is equally likely, including 1, 2, 3, 4, 5, 6. Turn on Sort the results to list them in order, as lottery tickets do.

### Why not just take the generator's output modulo the range?

Because the plain remainder favours some values whenever the range doesn't divide the number of possible outputs. A toy generator with 8 outputs (0–7) mapped to 3 values by x mod 3 gives remainders 0, 1, 2, 0, 1, 2, 0, 1, so two values get 3/8 and one gets 2/8. Rejecting outputs 6 and 7 makes each value exactly 1/3; this calculator applies the same rule to its 2⁶⁴ outputs.

### “⁨Random number generator (seeded)⁩” کتنا درست ہے؟

درستی آپ کی درج کردہ قدروں اور طریقے کے مفروضوں پر منحصر ہے۔ اعشاری حساب 50 بامعنی ہندسے استعمال کرتا ہے، مگر تخمینے، عددی طریقے اور ماخذ کا ڈیٹا کم درست ہو سکتے ہیں؛ دکھائی گئی قدروں کو راؤنڈ کرنے سے یہ حدود ختم نہیں ہوتیں۔ آزاد ذرائع کی حل شدہ مثالوں سے جانچ: 6۔ مثلاً، “⁨Ten integers 1–100, seed 2026 (defaults)⁩” کو ⁨Independent Python transcription of Vigna's splitmix64.c and xoshiro256starstar.c with the same rejection mapping (scratch script; its SplitMix64 matches the published seed-0 value 0xE220A8397B1DCDAF)⁩ سے جانچا جاتا ہے۔

### اس طریقے کا ماخذ کیا ہے؟

Blackman & Vigna, Scrambled linear pseudorandom number generators (xoshiro256**), ACM TOMS 47(4), 2021; Steele, Lea & Flood, Fast splittable pseudorandom number generators (SplitMix64), OOPSLA 2014; Fowler–Noll–Vo hash, FNV-1a 64-bit parameters (IETF draft-eastlake-fnv).

## ماخذ

- [Blackman & Vigna, Scrambled linear pseudorandom number generators (xoshiro256**), ACM TOMS 47(4), 2021](https://prng.di.unimi.it/)
- Steele, Lea & Flood, Fast splittable pseudorandom number generators (SplitMix64), OOPSLA 2014
- [Fowler–Noll–Vo hash, FNV-1a 64-bit parameters (IETF draft-eastlake-fnv)](https://datatracker.ietf.org/doc/html/draft-eastlake-fnv)
