Difference between revisions of "Template:Random number/testcases"

From MOASSpedia
Jump to navigation Jump to search
m (Fix Linter errors using AutoEd)
 
(No difference)

Latest revision as of 12:55, 9 December 2019

Testing sandbox version compared to main version

Clic purge to get new ouputs.
Code Result with sandbox template Result with main template Note
{{Random number}} Template:Random number/sandbox 70 default parameters (results range is 0..99)
{{Random number|100|323|67}} Template:Random number/sandbox (ok) 70 (ok) should be same as above (the default seed depends on current day of year, the default prime is 67)
{{Random number|10000}} Template:Random number/sandbox 1670 new parameters (results range in 0..9999)
{{Random number|10000|323|67}} Template:Random number/sandbox (ok) 1670 (ok) Should be same as above
{{Random number|10000|323|61}} Template:Random number/sandbox 6446 (use another prime) this and others should all be different
{{Random number|10000|6}} Template:Random number/sandbox 431 (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}} Template:Random number/sandbox 364
{{Random number|10000|4}} Template:Random number/sandbox 297
{{Random number|10000|3}} Template:Random number/sandbox 230
{{Random number|10000|2}} Template:Random number/sandbox 163
{{Random number|10000|1}} Template:Random number/sandbox 96
{{Random number|10000|0}} Template:Random number/sandbox 29
{{Random number|10000|6|2}} Template:Random number/sandbox 7774 (varying the seed) with a small prime (2) should still get distinct values in the linear sequence
{{Random number|10000|5|2}} Template:Random number/sandbox 7772
{{Random number|10000|4|2}} Template:Random number/sandbox 7770
{{Random number|10000|3|2}} Template:Random number/sandbox 7768
{{Random number|10000|2|2}} Template:Random number/sandbox 7766
{{Random number|10000|1|2}} Template:Random number/sandbox 7764 (varying now the prime number) should get distinct non-linear sequences
{{Random number|10000|1|3}} Template:Random number/sandbox 1648
{{Random number|10000|1|5}} Template:Random number/sandbox 9412
{{Random number|10000|1|7}} Template:Random number/sandbox 7176
{{Random number|10000|1|11}} Template:Random number/sandbox 2704
{{Random number|10000|1|13}} Template:Random number/sandbox 468
{{Random number|10000|1|17}} Template:Random number/sandbox 5996
{{Random number|10000|1|19}} Template:Random number/sandbox 3760
{{Random number|10000|1|23}} Template:Random number/sandbox 9288
{{Random number|10000|1|29}} Template:Random number/sandbox 2580
{{Random number|10000|1|31}} Template:Random number/sandbox 344
{{Random number|10000|1|37}} Template:Random number/sandbox 3636
{{Random number|10000|1|41}} Template:Random number/sandbox 9164
{{Random number|10000|1|43}} Template:Random number/sandbox 6928
{{Random number|10000|1|47}} Template:Random number/sandbox 2456
{{Random number|10000|1|51}} Template:Random number/sandbox 7984
{{Random number|10000|1|53}} Template:Random number/sandbox 5748
{{Random number|10000|1|59}} Template:Random number/sandbox 9040
{{Random number|10000|1|61}} Template:Random number/sandbox 6804
{{Random number|10000|1|67}} Template:Random number/sandbox 96
{{Random number|10000|1|71}} Template:Random number/sandbox 5624
{{Random number|10000|1|73}} Template:Random number/sandbox 3388
{{Random number|10000|1|79}} Template:Random number/sandbox 6680

Sandbox notes

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