6,906
edits
Progress Continues
We've already had 21582 updates since Dolphin 5.0. Keep up with Dolphin's continuing progress through the Dolphin Blog: February, March, and April 2024 Dolphin Progress Report. |
The Dolphin Emulator Wiki needs your help! Dolphin can play thousands of games, and changes are happening all the time. Help us keep up! Join in and help us make this the best resource for Dolphin. |
(Created page with "This template generates a pseudo-random integer between 0 and ''count''-1. ; Usage<nowiki>:</nowiki> * <tt><nowiki>{{</nowiki>Rand<nowiki>|</nowiki></tt>''count''<tt><nowiki>...") |
(clean up some stuff (for example, "odd prime" was redundant)) |
||
Line 1: | Line 1: | ||
This template generates a pseudo-random integer between 0 and ''count''-1. | This template generates a pseudo-random integer between 0 and ''count''-1. | ||
=== Usage === | |||
* <tt><nowiki>{{</nowiki>Rand<nowiki>|</nowiki></tt>''count''<tt><nowiki>|</nowiki></tt>''seed''<tt><nowiki>|</nowiki></tt>''prime''<tt><nowiki>}}</nowiki></tt> | * <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. | * All parameters are optional and have default values. They must be integers. | ||
Line 37: | Line 37: | ||
* <tt><nowiki>{{Rand|1000|1|79}}</nowiki></tt> = {{Rand|1000|0|79}} | * <tt><nowiki>{{Rand|1000|1|79}}</nowiki></tt> = {{Rand|1000|0|79}} | ||
=== Notes === | |||
* Varying ''seed'' | * Varying ''seed'' generates numbers in a linear sequence on the same page, with equal cyclic steps. | ||
* Varying ''prime'' (provided that | * Varying ''prime'' (provided that it is a prime number) generates pseudo-random numbers 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). | * 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. | * 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. |
edits