![]() | This is the template test cases page for the sandbox of Template:Random number. to update the examples. If there are many examples of a complicated template, later ones may break due to limits in MediaWiki; see the HTML comment "NewPP limit report" in the rendered page. You can also use Special:ExpandTemplates to examine the results of template uses. You can test how this page looks in the different skins and parsers with these links: |
Testing sandbox version compared to main version
editCode | Result with sandbox template | Result with main template | Note |
---|---|---|---|
{{Random number}} |
17 | 64 | default parameters (results range is 0..99) |
{{Random number|100|230|67}}
|
48 (KO) | 64 (ok) | should be same as above (the default seed depends on current day of year, the default prime is 67) |
{{Random number|10000}} |
9399 | 5164 | new parameters (results range in 0..9999) |
{{Random number|10000|230|67}}
|
297 (KO) | 5164 (ok) | Should be same as above |
{{Random number|10000|230|61}}
|
4220 | 7817 | (use another prime) this and others should all be different |
{{Random number|10000|6}} |
5236 | 156 | (varying the seed) note that the sequence is linear but the distance only depends on the value of the default prime (67) |
{{Random number|10000|5}} |
6341 | 89 | |
{{Random number|10000|4}} |
3032 | 22 | |
{{Random number|10000|3}} |
4061 | 9955 | |
{{Random number|10000|2}} |
6343 | 9888 | |
{{Random number|10000|1}} |
9175 | 9821 | |
{{Random number|10000|0}} |
7052 | 9754 | |
{{Random number|10000|6|2}} |
9339 | 8661 | (varying the seed) with a small prime (2) should still get distinct values in the linear sequence |
{{Random number|10000|5|2}} |
7216 | 8659 | |
{{Random number|10000|4|2}} |
6716 | 8657 | |
{{Random number|10000|3|2}} |
1784 | 8655 | |
{{Random number|10000|2|2}} |
4995 | 8653 | |
{{Random number|10000|1|2}} |
7218 | 8651 | (varying now the prime number) should get distinct non-linear sequences |
{{Random number|10000|1|3}} |
9505 | 2975 | |
{{Random number|10000|1|5}} |
1791 | 1625 | |
{{Random number|10000|1|7}} |
9663 | 278 | |
{{Random number|10000|1|11}} |
5261 | 7584 | |
{{Random number|10000|1|13}} |
3373 | 6237 | |
{{Random number|10000|1|17}} |
5484 | 3537 | |
{{Random number|10000|1|19}} |
4957 | 2175 | |
{{Random number|10000|1|23}} |
6602 | 9489 | |
{{Random number|10000|1|29}} |
3816 | 5434 | |
{{Random number|10000|1|31}} |
6634 | 4078 | |
{{Random number|10000|1|37}} |
388 | 34 | |
{{Random number|10000|1|41}} |
1493 | 7335 | |
{{Random number|10000|1|43}} |
7552 | 5994 | |
{{Random number|10000|1|47}} |
5985 | 3298 | |
{{Random number|10000|1|51}} |
7085 | 587 | |
{{Random number|10000|1|53}} |
2601 | 9250 | |
{{Random number|10000|1|59}} |
2125 | 5219 | |
{{Random number|10000|1|61}} |
1742 | 3848 | |
{{Random number|10000|1|67}} |
2842 | 9821 | |
{{Random number|10000|1|71}} |
8357 | 7109 | |
{{Random number|10000|1|73}} |
2686 | 5780 | |
{{Random number|10000|1|79}} |
9019 | 1743 |
Sandbox notes
editThis version uses fmod builtin operator (no longer need of Template:Mod) and the largest Mersenne prime (231−1) that fits in 32 bits.
This Mersenne prime is chosen to offer equal distribution when reducing the number of digits (better than bitmasking by an exact power of 2).
The next Mersenne prime (261−1) is too large to fit in 64-bit integers for computing products by reasonable primes (we could only use 2, 3, 5 or 7), or even just in the 52 bits of precision of a double float (used by #expr).