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

Cập nhật Ví dụ đã kiểm tra: 6

Draw without replacement, like lottery numbers.
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.
Thử
Kết quả
10, 13, 19, 87, 95, 37, 73, 40, 32, 34
Kết quả: 10, 13, 19, 87, 95, 37, 73, 40, 32, 34
Sum
440
Mean
44
Smallest
10
Largest
95

These 10 numbers come from seed “2026”: anyone using the same seed and settings gets exactly the same list, which makes draws auditable. Pseudorandom output like this is fine for games, sampling and simulations but not for passwords or cryptographic keys.

Each draw, in order

#1: 1010#1#2: 1313#2#3: 1919#3#4: 8787#4#5: 9595#5#6: 3737#6#7: 7373#7#8: 4040#8#9: 3232#9#10: 3434#10
Cách tính S
  1. Seed

    The seed 2026 is used directly as the 64-bit starting value.

  2. Generator state

    SplitMix64, started from the seed, fills the four 64-bit words of xoshiro256**, which then produces one 64-bit output per step.

  3. Map each output to the range without bias

    m=100,keep x<⌊264m⌋m,k=1+(x mod m)m = 100,\quad \text{keep } x < \left\lfloor \frac{2^{64}}{m} \right\rfloor m,\quad k = 1 + (x \bmod m)

    Rejecting the top sliver of outputs makes every value exactly equally likely. Results depend only on the seed; an unseeded mode using fresh entropy is not implemented in this calculation.

  4. Summary

    ∑=440,vˉ=44\sum = 440,\quad \bar v = 44

Giới thiệu Random number generator (seeded)

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.

Ví dụ có lời giải

Ten integers 1–100, seed 2026 (defaults)

Generate
Integers
Từ
1
Sang
100
How many
10
Seed
2026
Kết quả
10, 13, 19, 87, 95, 37, 73, 40, 32, 34
Sum
440
Smallest
10
Largest
95

Nguồn đối chiếu: 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
Từ
1
Sang
49
How many
6
No repeats
có
Sort the results
có
Seed
2026
Kết quả
11, 12, 18, 37, 40, 45
Sum
163

Nguồn đối chiếu: Same Python reference implementation

Five decimals in [0, 1] to 3 places

Generate
Decimals
Từ
0
Sang
1
How many
5
Decimal places
3
Seed
2026
Kết quả
0.683, 0.143, 0.793, 0.253, 0.375
Sum
2.247

Nguồn đối chiếu: 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
Kết quả
1, 6, 1
Sum
8

Nguồn đối chiếu: Python reference; the text seed hashes to FNV-1a 64 0xa430d84680aabd0b, the published FNV-1a hash of “hello”

Câu hỏi

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)” chính xác đến mức nào?

Độ chính xác phụ thuộc vào dữ liệu nhập và giả định của phương pháp. Phép tính thập phân dùng 50 chữ số có nghĩa, nhưng ước lượng, phương pháp số và dữ liệu nguồn có thể kém chính xác hơn; làm tròn khi hiển thị không loại bỏ các giới hạn đó. Ví dụ có lời giải đã đối chiếu với nguồn độc lập: 6. Ví dụ, “Ten integers 1–100, seed 2026 (defaults)” được kiểm tra bằng 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).

Phương pháp này lấy từ đâu?

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

Về công cụ tính này

v=min+(x mod m),m=max−min+1keeping only x<⌊264/m⌋m\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}

Nguồn

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

Đã đối chiếu nguồn tham khảo

Công cụ tính này có 6 ví dụ đã giải với đáp án từ các nguồn độc lập. Chúng được chạy trong bộ kiểm thử và bạn cũng có thể chạy tại đây.

Công cụ liên quan