Template:Random number/testcases

From Wikipedia, the free encyclopedia


Testing sandbox version compared to main version[edit]

Clic purge to get new ouputs.
Code Result with sandbox template Result with main template Note
{{Random number}} 74 48 default parameters (results range is 0..99)
{{Random number|100|155|67}} 12 (KO) 48 (ok) should be same as above (the default seed depends on current day of year, the default prime is 67)
{{Random number|10000}} 7901 448 new parameters (results range in 0..9999)
{{Random number|10000|155|67}} 8445 (KO) 448 (ok) Should be same as above
{{Random number|10000|155|61}} 6883 6550 (use another prime) this and others should all be different
{{Random number|10000|6}} 7433 465 (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}} 3574 398
{{Random number|10000|4}} 9720 331
{{Random number|10000|3}} 9328 264
{{Random number|10000|2}} 9519 197
{{Random number|10000|1}} 433 130
{{Random number|10000|0}} 6573 63
{{Random number|10000|6|2}} 7125 4343 (varying the seed) with a small prime (2) should still get distinct values in the linear sequence
{{Random number|10000|5|2}} 3270 4341
{{Random number|10000|4|2}} 9460 4339
{{Random number|10000|3|2}} 9961 4337
{{Random number|10000|2|2}} 6109 4335
{{Random number|10000|1|2}} 2386 4333 (varying now the prime number) should get distinct non-linear sequences
{{Random number|10000|1|3}} 8384 1500
{{Random number|10000|1|5}} 8942 5833
{{Random number|10000|1|7}} 5024 163
{{Random number|10000|1|11}} 7051 8830
{{Random number|10000|1|13}} 7581 3158
{{Random number|10000|1|17}} 2617 1824
{{Random number|10000|1|19}} 8706 6172
{{Random number|10000|1|23}} 4852 4834
{{Random number|10000|1|29}} 5007 7828
{{Random number|10000|1|31}} 1543 2165
{{Random number|10000|1|37}} 7689 5158
{{Random number|10000|1|41}} 2648 3830
{{Random number|10000|1|43}} 8789 8151
{{Random number|10000|1|47}} 4952 6815
{{Random number|10000|1|51}} 1076 5468
{{Random number|10000|1|53}} 7216 9833
{{Random number|10000|1|59}} 8667 2826
{{Random number|10000|1|61}} 9738 7156
{{Random number|10000|1|67}} 291 130
{{Random number|10000|1|71}} 6785 8798
{{Random number|10000|1|73}} 2574 3136
{{Random number|10000|1|79}} 4371 6135

Sandbox notes[edit]

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