UnGames:Main Page/Editing Guideline/Random
Jump to navigation
Jump to search
Game List | Editing Rules | Editing Guides |
Method 1 - <option>[edit | edit source]
<choose> <option weight=(optional)>(Text A)</option> <option weight=(optional)>(Text B)</option> (...) </choose>
“You can use it in quota template (B)”
<option> is
massive use[edit | edit source]
<choose><option weight=1>a</option><option weight=1>b</option></choose>
a a a a b a b a a a
The result probably will repeats when you refresh the webpage.
Method 1 - Template:Rand[edit | edit source]
This template is using the time to generate a random number.
{{Rand| (range) | (seed) | (prime) }}
例子:
- {{Rand}} 82
- {{Rand|256}} 118
- {{Rand|1000}} 182
- {{Rand|1000|3.14}} 966
Add Minimum[edit | edit source]
{{#expr: (Minimum) + {{Rand|(Maxium-Minimum)+1)| (seed) | (prime) }}}}
- {{#expr: 500 + {{Rand|500}}}}
500-999: 682
Pads the random number to the specified width[edit | edit source]
{{padleft:{{Rand| (range) | (seed) | (prime) }}| (digis) |0}}
- {{padleft:{{Rand|9999}}|4|0}}
000-9999: 7402
Problem[edit | edit source]
Template:Rand is using time to generate random number, so two {{Rand}} will cause same result.
If no seed or prime is inputed, they will get same result.
{{Rand|85000}}、{{Rand|85000}}、{{Rand|85000}}
68182, 68182, 68182
If you want to generate two random number, you should use Mod to separate a big number to two.
comparison[edit | edit source]
- If you just want to display random test, it's more convenient to use <option>.
- <option> cannot work in Parser Functions. Use {{Rand}}.