Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
RandomNumberGenerator¶
Inherits: RefCounted < Object
Provides methods for generating pseudo-random numbers.
Description¶
RandomNumberGenerator is a class for generating pseudo-random numbers. It currently uses PCG32.
Note: The underlying algorithm is an implementation detail and should not be depended upon.
To generate a random float number (within a given range) based on a time-dependant seed:
var rng = RandomNumberGenerator.new()
func _ready():
var my_random_number = rng.randf_range(-10.0, 10.0)
Tutorials¶
Properties¶
|
||
|
Methods¶
randf ( ) |
|
randf_range ( float from, float to ) |
|
randi ( ) |
|
randi_range ( int from, int to ) |
|
void |