Merge pull request #43318 from akien-mga/doc-rng-seed
doc: Override default value for RandomNumberGenerator.seed
This commit is contained in:
commit
494bf38c76
2 changed files with 6 additions and 2 deletions
|
@ -33,7 +33,6 @@
|
||||||
void RandomNumberGenerator::_bind_methods() {
|
void RandomNumberGenerator::_bind_methods() {
|
||||||
ClassDB::bind_method(D_METHOD("set_seed", "seed"), &RandomNumberGenerator::set_seed);
|
ClassDB::bind_method(D_METHOD("set_seed", "seed"), &RandomNumberGenerator::set_seed);
|
||||||
ClassDB::bind_method(D_METHOD("get_seed"), &RandomNumberGenerator::get_seed);
|
ClassDB::bind_method(D_METHOD("get_seed"), &RandomNumberGenerator::get_seed);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "seed"), "set_seed", "get_seed");
|
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("randi"), &RandomNumberGenerator::randi);
|
ClassDB::bind_method(D_METHOD("randi"), &RandomNumberGenerator::randi);
|
||||||
ClassDB::bind_method(D_METHOD("randf"), &RandomNumberGenerator::randf);
|
ClassDB::bind_method(D_METHOD("randf"), &RandomNumberGenerator::randf);
|
||||||
|
@ -41,4 +40,8 @@ void RandomNumberGenerator::_bind_methods() {
|
||||||
ClassDB::bind_method(D_METHOD("randf_range", "from", "to"), &RandomNumberGenerator::randf_range);
|
ClassDB::bind_method(D_METHOD("randf_range", "from", "to"), &RandomNumberGenerator::randf_range);
|
||||||
ClassDB::bind_method(D_METHOD("randi_range", "from", "to"), &RandomNumberGenerator::randi_range);
|
ClassDB::bind_method(D_METHOD("randi_range", "from", "to"), &RandomNumberGenerator::randi_range);
|
||||||
ClassDB::bind_method(D_METHOD("randomize"), &RandomNumberGenerator::randomize);
|
ClassDB::bind_method(D_METHOD("randomize"), &RandomNumberGenerator::randomize);
|
||||||
|
|
||||||
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "seed"), "set_seed", "get_seed");
|
||||||
|
// Default value is non-deterministic, override it for doc generation purposes.
|
||||||
|
ADD_PROPERTY_DEFAULT("seed", 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,9 +74,10 @@
|
||||||
</method>
|
</method>
|
||||||
</methods>
|
</methods>
|
||||||
<members>
|
<members>
|
||||||
<member name="seed" type="int" setter="set_seed" getter="get_seed" default="-6398989897141750821">
|
<member name="seed" type="int" setter="set_seed" getter="get_seed" default="0">
|
||||||
The seed used by the random number generator. A given seed will give a reproducible sequence of pseudo-random numbers.
|
The seed used by the random number generator. A given seed will give a reproducible sequence of pseudo-random numbers.
|
||||||
[b]Note:[/b] The RNG does not have an avalanche effect, and can output similar random streams given similar seeds. Consider using a hash function to improve your seed quality if they're sourced externally.
|
[b]Note:[/b] The RNG does not have an avalanche effect, and can output similar random streams given similar seeds. Consider using a hash function to improve your seed quality if they're sourced externally.
|
||||||
|
[b]Note:[/b] The default value of this property is pseudo-random, and changes when calling [method randomize]. The [code]0[/code] value documented here is a placeholder, and not the actual default seed.
|
||||||
</member>
|
</member>
|
||||||
</members>
|
</members>
|
||||||
<constants>
|
<constants>
|
||||||
|
|
Loading…
Reference in a new issue