Difference between revisions of "Template:PRNG"

From QBWiki
Jump to navigation Jump to search
(Created page with "<includeonly>{{#vardefine:m|65537}}{{#expr:75*{{{1|1}}} mod {{#var:m}}}}</includeonly><noinclude>{{Template doc| A simple [https://en.wikipedia.org/wiki/Linear_congruential_ge...")
 
m
Line 1: Line 1:
<includeonly>{{#vardefine:m|65537}}{{#expr:75*{{{1|1}}} mod {{#var:m}}}}</includeonly><noinclude>{{Template doc|
+
<includeonly>{{#expr:75*{{{1|1}}} mod {{{2|65537}}}}}</includeonly><noinclude>{{Template doc|
 
A simple [https://en.wikipedia.org/wiki/Linear_congruential_generator linear congruential generator] for generating bad random numbers using the parameters "<nowiki>X_{n+1}=75 X_n mod 65537</nowiki>" (which is the same values as the ZX Spectrum apparently).
 
A simple [https://en.wikipedia.org/wiki/Linear_congruential_generator linear congruential generator] for generating bad random numbers using the parameters "<nowiki>X_{n+1}=75 X_n mod 65537</nowiki>" (which is the same values as the ZX Spectrum apparently).
 +
 +
arg1 - input
 +
arg2 - mod (optional)
  
 
<pre>
 
<pre>
 
{{PRNG|1}}, {{PRNG|2}}, {{PRNG|3}}, {{PRNG|4}}, {{PRNG|5}}
 
{{PRNG|1}}, {{PRNG|2}}, {{PRNG|3}}, {{PRNG|4}}, {{PRNG|5}}
 +
 +
{{PRNG|1|7}}, {{PRNG|2|7}}, {{PRNG|3|7}}, {{PRNG|4|7}}, {{PRNG|5|7}}
 
</pre>
 
</pre>
 
{{PRNG|1}}, {{PRNG|2}}, {{PRNG|3}}, {{PRNG|4}}, {{PRNG|5}}
 
{{PRNG|1}}, {{PRNG|2}}, {{PRNG|3}}, {{PRNG|4}}, {{PRNG|5}}
 +
 +
{{PRNG|1|7}}, {{PRNG|2|7}}, {{PRNG|3|7}}, {{PRNG|4|7}}, {{PRNG|5|7}}
 
}}</noinclude>
 
}}</noinclude>

Revision as of 21:53, 14 December 2025

Template documentation

A simple linear congruential generator for generating bad random numbers using the parameters "X_{n+1}=75 X_n mod 65537" (which is the same values as the ZX Spectrum apparently).

arg1 - input arg2 - mod (optional)

{{PRNG|1}}, {{PRNG|2}}, {{PRNG|3}}, {{PRNG|4}}, {{PRNG|5}}

{{PRNG|1|7}}, {{PRNG|2|7}}, {{PRNG|3|7}}, {{PRNG|4|7}}, {{PRNG|5|7}}

75, 150, 225, 300, 375

5, 3, 1, 6, 4