# 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/ja/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)
