User:Misza13/Random
From Wikipedia, the free encyclopedia
This template is an attempt at creating a "random number generator" using WikiSyntax. It generates pseudorandom numbers that change whenever a page containing it is edited or every minute (the latter update may require purging the page's cache).
Usage:
- {{User:Misza13/Random}} produces a random decimal digit: 4
- {{User:Misza13/Random|N|M}} produces a random number from M to M+N-1, i.e. it rolls a 1dN+M-1, where the M, if ommited, is set to 0. (As you might've guessed by now, N defaults to 10.) Example: {{User:Misza13/Random|90|10}} generates a two-digit number: 64
You can (or rather should!) also specify up to 6 seeds for the generator, which (I think) should be different prime numbers:
- {{User:Misza13/Random|seed1=7|seed2=47}} gives 8
- {{User:Misza13/Random|seed2=11|seed5=59|seed6=3}} gives 6
Notes:
- This template does not render properly when previewing a page. This is because the {{REVISIONID}} variable (one of the sources of "randomness") is not set on preview. It will show up after saving, though.
- The seed parameters should not be set to high values to avoid integer overflow. You'll know something's wrong when the generator produces negative numbers while it shouldn't.