Edge Rewrite
// HTMLRewriter · presentation

This page was redesigned at the edge.

Cloudflare fetched the original article and streamed it through HTMLRewriter to apply an entirely new visual system without rebuilding the source page.

// request.cf · coarse context

A page that knows where it met you.

Only coarse request metadata is shown. This demo does not display or persist visitor IP addresses.

Country
US
Cloudflare location
CMH
Connection
HTTP/2
Language
Not provided

Ray ID: a2214b2e8aa7224d

Jump to content

Template:Random number/testcases

From Wikipedia, the free encyclopedia

Testing sandbox version compared to main version

[edit]
Clic purge to get new ouputs.
CodeResult with sandbox templateResult with main templateNote
{{Random number}}1414default parameters (results range is 0..99)
{{Random number|100|208|67}} 14 (ok) 14 (ok) should be same as above (the default seed depends on current day of year, the default prime is 67)
{{Random number|10000}}87148714new parameters (results range in 0..9999)
{{Random number|10000|208|67}} 8714 (ok) 8714 (ok) Should be same as above
{{Random number|10000|208|61}} 176 176 (use another prime) this and others should all be different
{{Random number|10000|6}}51805180(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}}51135113
{{Random number|10000|4}}50465046
{{Random number|10000|3}}49794979
{{Random number|10000|2}}49124912
{{Random number|10000|1}}48454845
{{Random number|10000|0}}47784778
{{Random number|10000|6|2}}91099109(varying the seed) with a small prime (2) should still get distinct values in the linear sequence
{{Random number|10000|5|2}}91079107
{{Random number|10000|4|2}}91059105
{{Random number|10000|3|2}}91039103
{{Random number|10000|2|2}}91019101
{{Random number|10000|1|2}}90999099(varying now the prime number) should get distinct non-linear sequences
{{Random number|10000|1|3}}36493649
{{Random number|10000|1|5}}27472747
{{Random number|10000|1|7}}18441844
{{Random number|10000|1|11}}4141
{{Random number|10000|1|13}}91469146
{{Random number|10000|1|17}}73377337
{{Random number|10000|1|19}}64426442
{{Random number|10000|1|23}}46454645
{{Random number|10000|1|29}}19391939
{{Random number|10000|1|31}}10361036
{{Random number|10000|1|37}}83448344
{{Random number|10000|1|41}}65326532
{{Random number|10000|1|43}}56375637
{{Random number|10000|1|47}}38373837
{{Random number|10000|1|51}}20372037
{{Random number|10000|1|53}}11111111
{{Random number|10000|1|59}}84158415
{{Random number|10000|1|61}}75497549
{{Random number|10000|1|67}}48454845
{{Random number|10000|1|71}}29872987
{{Random number|10000|1|73}}20792079
{{Random number|10000|1|79}}94169416

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