Difference between revisions of "Template:RNG"
Jump to navigation
Jump to search
m (Page Specific.) |
(Added standard transclusion tags.) |
||
(3 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
− | <!--DISCLAIMER:I restrict my RNG calculation time to 0.5 secs | + | <includeonly><!--DISCLAIMER:I restrict my RNG calculation time to 0.5 secs.--> |
{{impressive}} | {{impressive}} | ||
− | Generic random number:<onlyinclude> | + | Generic pseudo-random number:<onlyinclude> |
− | {{#expr:(({{{seed|0}}} | + | {{#expr:(trunc (({{REVISIONTIMESTAMP}}+{{{seed|0}}})^2/10)-{{{seed|0}}}+{{REVISIONTIMESTAMP}})*327 mod {{{limit|100}}}}} |
</onlyinclude> | </onlyinclude> | ||
<!--More cases coming soon!--> | <!--More cases coming soon!--> | ||
Line 11: | Line 11: | ||
Seed 2 limit 30:{{RNG |seed=2|limit=30}}<br /> | Seed 2 limit 30:{{RNG |seed=2|limit=30}}<br /> | ||
Seed 1:{{RNG |seed=1}} | Seed 1:{{RNG |seed=1}} | ||
− | </div> | + | </div></includeonly><noinclude> |
− | + | {{documentation}}</noinclude> | |
− |
Latest revision as of 20:30, 10 February 2021
Description[edit]
This template is used to generate random numbers in a relatively short time.
Usage[edit]
Type {{RNG}}
on the page to assume a seed of 0 and a limit of 100.
NOTE: Setting a limit value to something greater than 1 000 000 WILL have an effect on the randomness of the result. Use two {{RNG}} templates instead. {{RNG |seed=(number) -->Makes RNGs with different seeds unique to each other. |limit=(number) -->Restricts the RNG to produce only numbers from 1 to limit. }}
Example:
{{RNG |seed=1234 |limit=5000}}
results in: -4456
The above documentation is transcluded from Template:RNG/doc. (edit | history) Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages. Please add categories to the /doc subpage. Subpages of this template. |