Difference between revisions of "Template:Pseudorand"

From Twilight Heroes Wiki
Jump to: navigation, search
(New page: <includeonly>{{#expr: {{#time: U}} mod {{{1}}}}}</includeonly><noinclude>This template accepts one parameter X, and will return a different number every time it is used, between 0 and X-1....)
 
m
Line 1: Line 1:
<includeonly>{{#expr: {{#time: U}} mod {{{1}}}}}</includeonly><noinclude>This template accepts one parameter X, and will return a different number every time it is used, between 0 and X-1. However, the number isn't random, it is based on the current time. Due to a bug with the mod function it doesn't even use the microsecond time '''<nowiki>{{CURRENTTIMESTAMP}}</nowiki>''' but the time in seconds, making it even further away from being random.
+
<includeonly>{{#expr: {{#time: U}} mod {{{1}}}}}</includeonly><noinclude>This template accepts one parameter X, and will return a different number every time it is used, between 0 and X-1. However, the number isn't random, it is based on the current time.
  
 
For example, '''<nowiki>{{pseudorand|13}}</nowiki>''' returns {{#expr: {{#time: U}} mod 13}}.[[Category:Templates]]</noinclude>
 
For example, '''<nowiki>{{pseudorand|13}}</nowiki>''' returns {{#expr: {{#time: U}} mod 13}}.[[Category:Templates]]</noinclude>

Revision as of 07:03, 2 August 2009

This template accepts one parameter X, and will return a different number every time it is used, between 0 and X-1. However, the number isn't random, it is based on the current time.

For example, {{pseudorand|13}} returns 3.