Jump to content

User:John of Reading/X2: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
yup worked perfectly
Add {{purge}} at the top for easy testing
(33 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{purge}} this page to see a different set of numbers.
==I am testing an issue with the db-repost template==
*Please do NOT delete this page
*Please see [[Wikipedia:Village_pump_(technical)#CSD_template_weirdness]]
*I will remove the db-repost template in a few minutes


This template generates a [[pseudo-random]] integer between 0 and ''count''-1.
{{tlp|db-repost|Wikipedia:Articles for deletion/Company of Heroes: Eastern Front}}

; Usage<nowiki>:</nowiki>
* <tt><nowiki>{{</nowiki>Rand<nowiki>|</nowiki></tt>''count''<tt><nowiki>|</nowiki></tt>''seed''<tt><nowiki>|</nowiki></tt>''prime''<tt><nowiki>}}</nowiki></tt>
* All parameters are optional and have default values. They must be integers.
* The default ''count'' is 100 (so by default, this template generates values between 0 and 99) and must be non-zero.
* The default ''seed'' is <nowiki>{{#time:z}}</nowiki> and can be set to any other integer value (used to generate distinct values on the same page).
* The default ''prime'' is 67 and should be a [[prime number]] above 17 (used to generate distinct values on the same page).

; Examples generating numbers between 0 and 999<nowiki>:</nowiki>
* <tt><nowiki>{{User:John of Reading/X1|1000}}</nowiki></tt> = {{User:John of Reading/X1|1000}}
* <tt><nowiki>{{User:John of Reading/X1|1000|</nowiki>{{#time:z}}<nowiki>|67}}</nowiki></tt> = {{User:John of Reading/X1|1000|{{#time:z}}|67}} (same as above)
* <tt><nowiki>{{User:John of Reading/X1|1000|</nowiki>{{#time:z}}<nowiki>|61}}</nowiki></tt> = {{User:John of Reading/X1|1000|{{#time:z}}|61}} (this and others should all be different)
* <tt><nowiki>{{User:John of Reading/X1|1000|6}}</nowiki></tt> = {{User:John of Reading/X1|1000|6}}
* <tt><nowiki>{{User:John of Reading/X1|1000|5}}</nowiki></tt> = {{User:John of Reading/X1|1000|5}}
* <tt><nowiki>{{User:John of Reading/X1|1000|4}}</nowiki></tt> = {{User:John of Reading/X1|1000|4}}
* <tt><nowiki>{{User:John of Reading/X1|1000|3}}</nowiki></tt> = {{User:John of Reading/X1|1000|3}}
* <tt><nowiki>{{User:John of Reading/X1|1000|2}}</nowiki></tt> = {{User:John of Reading/X1|1000|2}}
* <tt><nowiki>{{User:John of Reading/X1|1000|1}}</nowiki></tt> = {{User:John of Reading/X1|1000|1}}
* <tt><nowiki>{{User:John of Reading/X1|1000|0}}</nowiki></tt> = {{User:John of Reading/X1|1000|0}}
* <tt><nowiki>{{User:John of Reading/X1|1000|1|17}}</nowiki></tt> = {{User:John of Reading/X1|1000|0|17}} (varying the prime number)
* <tt><nowiki>{{User:John of Reading/X1|1000|1|19}}</nowiki></tt> = {{User:John of Reading/X1|1000|0|19}}
* <tt><nowiki>{{User:John of Reading/X1|1000|1|23}}</nowiki></tt> = {{User:John of Reading/X1|1000|0|23}}
* <tt><nowiki>{{User:John of Reading/X1|1000|1|29}}</nowiki></tt> = {{User:John of Reading/X1|1000|0|29}}
* <tt><nowiki>{{User:John of Reading/X1|1000|1|31}}</nowiki></tt> = {{User:John of Reading/X1|1000|0|31}}
* <tt><nowiki>{{User:John of Reading/X1|1000|1|37}}</nowiki></tt> = {{User:John of Reading/X1|1000|0|37}}
* <tt><nowiki>{{User:John of Reading/X1|1000|1|41}}</nowiki></tt> = {{User:John of Reading/X1|1000|0|41}}
* <tt><nowiki>{{User:John of Reading/X1|1000|1|43}}</nowiki></tt> = {{User:John of Reading/X1|1000|0|43}}
* <tt><nowiki>{{User:John of Reading/X1|1000|1|47}}</nowiki></tt> = {{User:John of Reading/X1|1000|0|47}}
* <tt><nowiki>{{User:John of Reading/X1|1000|1|51}}</nowiki></tt> = {{User:John of Reading/X1|1000|0|51}}
* <tt><nowiki>{{User:John of Reading/X1|1000|1|53}}</nowiki></tt> = {{User:John of Reading/X1|1000|0|53}}
* <tt><nowiki>{{User:John of Reading/X1|1000|1|59}}</nowiki></tt> = {{User:John of Reading/X1|1000|0|59}}
* <tt><nowiki>{{User:John of Reading/X1|1000|1|61}}</nowiki></tt> = {{User:John of Reading/X1|1000|0|61}}
* <tt><nowiki>{{User:John of Reading/X1|1000|1|67}}</nowiki></tt> = {{User:John of Reading/X1|1000|0|67}}
* <tt><nowiki>{{User:John of Reading/X1|1000|1|71}}</nowiki></tt> = {{User:John of Reading/X1|1000|0|71}}
* <tt><nowiki>{{User:John of Reading/X1|1000|1|73}}</nowiki></tt> = {{User:John of Reading/X1|1000|0|73}}
* <tt><nowiki>{{User:John of Reading/X1|1000|1|79}}</nowiki></tt> = {{User:John of Reading/X1|1000|0|79}}

; Note<nowiki>:</nowiki>
* Varying ''seed'' linearly generates numbers that generate a linear sequence on the same page, with equal cyclic steps;
* Varying ''prime'' (provided that they are odd prime numbers) generates pseudo-random that have independent random distribution.
* Note that when ''count'' is even (such as 100 by default, or 1000 in the examples above), the generated numbers (on the same page) are all odd or all even when you are varying the ''seed'' or ''prime'', unless half of the calls use an even ''seed'' and the others used an odd ''seed''. However, later invokations will still alternate odd and even numbers on output (this problem only occurs on the same page where multiple random numbers are invoked).
* On the same page, multiple invokations of this template with the same parameters will generate the same output value, so it is possible to create multiple links related to the same article.
<includeonly>
[[Category:Mathematical function templates|{{PAGENAME}}]]
[[ar:قالب:Rand]]
[[cr:Template:Rand]]
[[fr:Modèle:Rand]]
[[ku:Şablon:Rand]]
[[mk:Шаблон:Random number]]
[[pt:Predefinição:Rand2]]
[[ru:Шаблон:Rand]]
[[fi:Malline:Rand]]
</includeonly>

Revision as of 12:48, 11 October 2011

Purge this page to see a different set of numbers.

This template generates a pseudo-random integer between 0 and count-1.

Usage:
  • {{Rand|count|seed|prime}}
  • All parameters are optional and have default values. They must be integers.
  • The default count is 100 (so by default, this template generates values between 0 and 99) and must be non-zero.
  • The default seed is {{#time:z}} and can be set to any other integer value (used to generate distinct values on the same page).
  • The default prime is 67 and should be a prime number above 17 (used to generate distinct values on the same page).
Examples generating numbers between 0 and 999:
  • {{User:John of Reading/X1|1000}} =

blah blah a EU blah blah

blah blah a eu blah blah

blah blah a euphemism blah blah

il a eu un

there was a aircraft

  • {{User:John of Reading/X1|1000|314|67}} =

blah blah a EU blah blah

blah blah a eu blah blah

blah blah a euphemism blah blah

il a eu un

there was a aircraft (same as above)

  • {{User:John of Reading/X1|1000|314|61}} =

blah blah a EU blah blah

blah blah a eu blah blah

blah blah a euphemism blah blah

il a eu un

there was a aircraft (this and others should all be different)

  • {{User:John of Reading/X1|1000|6}} =

blah blah a EU blah blah

blah blah a eu blah blah

blah blah a euphemism blah blah

il a eu un

there was a aircraft

  • {{User:John of Reading/X1|1000|5}} =

blah blah a EU blah blah

blah blah a eu blah blah

blah blah a euphemism blah blah

il a eu un

there was a aircraft

  • {{User:John of Reading/X1|1000|4}} =

blah blah a EU blah blah

blah blah a eu blah blah

blah blah a euphemism blah blah

il a eu un

there was a aircraft

  • {{User:John of Reading/X1|1000|3}} =

blah blah a EU blah blah

blah blah a eu blah blah

blah blah a euphemism blah blah

il a eu un

there was a aircraft

  • {{User:John of Reading/X1|1000|2}} =

blah blah a EU blah blah

blah blah a eu blah blah

blah blah a euphemism blah blah

il a eu un

there was a aircraft

  • {{User:John of Reading/X1|1000|1}} =

blah blah a EU blah blah

blah blah a eu blah blah

blah blah a euphemism blah blah

il a eu un

there was a aircraft

  • {{User:John of Reading/X1|1000|0}} =

blah blah a EU blah blah

blah blah a eu blah blah

blah blah a euphemism blah blah

il a eu un

there was a aircraft

  • {{User:John of Reading/X1|1000|1|17}} =

blah blah a EU blah blah

blah blah a eu blah blah

blah blah a euphemism blah blah

il a eu un

there was a aircraft (varying the prime number)

  • {{User:John of Reading/X1|1000|1|19}} =

blah blah a EU blah blah

blah blah a eu blah blah

blah blah a euphemism blah blah

il a eu un

there was a aircraft

  • {{User:John of Reading/X1|1000|1|23}} =

blah blah a EU blah blah

blah blah a eu blah blah

blah blah a euphemism blah blah

il a eu un

there was a aircraft

  • {{User:John of Reading/X1|1000|1|29}} =

blah blah a EU blah blah

blah blah a eu blah blah

blah blah a euphemism blah blah

il a eu un

there was a aircraft

  • {{User:John of Reading/X1|1000|1|31}} =

blah blah a EU blah blah

blah blah a eu blah blah

blah blah a euphemism blah blah

il a eu un

there was a aircraft

  • {{User:John of Reading/X1|1000|1|37}} =

blah blah a EU blah blah

blah blah a eu blah blah

blah blah a euphemism blah blah

il a eu un

there was a aircraft

  • {{User:John of Reading/X1|1000|1|41}} =

blah blah a EU blah blah

blah blah a eu blah blah

blah blah a euphemism blah blah

il a eu un

there was a aircraft

  • {{User:John of Reading/X1|1000|1|43}} =

blah blah a EU blah blah

blah blah a eu blah blah

blah blah a euphemism blah blah

il a eu un

there was a aircraft

  • {{User:John of Reading/X1|1000|1|47}} =

blah blah a EU blah blah

blah blah a eu blah blah

blah blah a euphemism blah blah

il a eu un

there was a aircraft

  • {{User:John of Reading/X1|1000|1|51}} =

blah blah a EU blah blah

blah blah a eu blah blah

blah blah a euphemism blah blah

il a eu un

there was a aircraft

  • {{User:John of Reading/X1|1000|1|53}} =

blah blah a EU blah blah

blah blah a eu blah blah

blah blah a euphemism blah blah

il a eu un

there was a aircraft

  • {{User:John of Reading/X1|1000|1|59}} =

blah blah a EU blah blah

blah blah a eu blah blah

blah blah a euphemism blah blah

il a eu un

there was a aircraft

  • {{User:John of Reading/X1|1000|1|61}} =

blah blah a EU blah blah

blah blah a eu blah blah

blah blah a euphemism blah blah

il a eu un

there was a aircraft

  • {{User:John of Reading/X1|1000|1|67}} =

blah blah a EU blah blah

blah blah a eu blah blah

blah blah a euphemism blah blah

il a eu un

there was a aircraft

  • {{User:John of Reading/X1|1000|1|71}} =

blah blah a EU blah blah

blah blah a eu blah blah

blah blah a euphemism blah blah

il a eu un

there was a aircraft

  • {{User:John of Reading/X1|1000|1|73}} =

blah blah a EU blah blah

blah blah a eu blah blah

blah blah a euphemism blah blah

il a eu un

there was a aircraft

  • {{User:John of Reading/X1|1000|1|79}} =

blah blah a EU blah blah

blah blah a eu blah blah

blah blah a euphemism blah blah

il a eu un

there was a aircraft

Note:
  • Varying seed linearly generates numbers that generate a linear sequence on the same page, with equal cyclic steps;
  • Varying prime (provided that they are odd prime numbers) generates pseudo-random that have independent random distribution.
  • Note that when count is even (such as 100 by default, or 1000 in the examples above), the generated numbers (on the same page) are all odd or all even when you are varying the seed or prime, unless half of the calls use an even seed and the others used an odd seed. However, later invokations will still alternate odd and even numbers on output (this problem only occurs on the same page where multiple random numbers are invoked).
  • On the same page, multiple invokations of this template with the same parameters will generate the same output value, so it is possible to create multiple links related to the same article.