Bases: StructBase
Thread-safe random number generator that can be manually seeded.
note: The full C++ class is located here: EngineSourceRuntimeCorePublicMathRandomStream.h
C++ Source:
Module: CoreUObject
File: NoExportTypes.h
Editor Properties: (see get_editor_property/set_editor_property)
-
generate_new_seed() → None
Create a new random seed for a random stream
-
property initial_seed: int
[Read-Write] Holds the initial seed.
- Type:
(int32)
-
random_bool() → bool
Returns a random bool
- Return type:
bool
-
random_bool_with_weight(weight=0.500000) → bool
- Get a random chance with the specified weight. Range of weight is 0.0 - 1.0 E.g.,
Weight = .6 return value = True 60% of the time
- Parameters:
weight (float) –
- Return type:
bool
-
random_float() → float
Returns a random float between 0 and 1
- Return type:
float
-
random_float_in_range(min, max) → float
Generate a random number between Min and Max
- Parameters:
-
- Return type:
float
-
random_int(max) → int32
Returns a uniformly distributed random number between 0 and Max - 1
- Parameters:
max (int32) –
- Return type:
int32
-
random_int_in_range(min, max) → int32
Return a random integer between Min and Max (>= Min and <= Max)
- Parameters:
min (int32) –
max (int32) –
- Return type:
int32
-
random_point_in_bounded_box(center, half_size) → Vector
Returns a random point within the specified bounding box using the first vector as an origin and the second as the half size of the AABB.
- Parameters:
-
- Return type:
Vector
-
random_point_in_box(box) → Vector
Returns a random point within the specified bounding box.
- Parameters:
box (Box) –
- Return type:
Vector
-
random_rotator(roll) → Rotator
Create a random rotation
- Parameters:
roll (bool) –
- Return type:
Rotator
-
random_unit_vector() → Vector
Returns a random vector with length of 1.0
- Return type:
Vector
-
random_unit_vector_in_cone_in_degrees(cone_dir, cone_half_angle_in_degrees) → Vector
Returns a random vector with length of 1, within the specified cone, with uniform random distribution.
- Parameters:
cone_dir (Vector) – The base “center” direction of the cone.
cone_half_angle_in_degrees (float) – The half-angle of the cone (from ConeDir to edge), in degrees.
- Return type:
Vector
-
random_unit_vector_in_cone_in_radians(cone_dir, cone_half_angle_in_radians) → Vector
Returns a random vector with length of 1, within the specified cone, with uniform random distribution.
- Parameters:
cone_dir (Vector) – The base “center” direction of the cone.
cone_half_angle_in_radians (float) – The half-angle of the cone (from ConeDir to edge), in radians.
- Return type:
Vector
-
random_unit_vector_in_elliptical_cone_in_degrees(cone_dir, max_yaw_in_degrees, max_pitch_in_degrees) → Vector
Returns a random vector with length of 1, within the specified cone, with uniform random distribution.
The shape of the cone can be modified according to the yaw and pitch angles.
- Parameters:
cone_dir (Vector) –
max_yaw_in_degrees (float) – The yaw angle of the cone (from ConeDir to horizontal edge), in degrees.
max_pitch_in_degrees (float) – The pitch angle of the cone (from ConeDir to vertical edge), in degrees.
- Return type:
Vector
-
random_unit_vector_in_elliptical_cone_in_radians(cone_dir, max_yaw_in_radians, max_pitch_in_radians) → Vector
Returns a random vector with length of 1, within the specified cone, with uniform random distribution.
The shape of the cone can be modified according to the yaw and pitch angles.
- Parameters:
cone_dir (Vector) –
max_yaw_in_radians (float) – The yaw angle of the cone (from ConeDir to horizontal edge), in radians.
max_pitch_in_radians (float) – The pitch angle of the cone (from ConeDir to vertical edge), in radians.
- Return type:
Vector
-
reset() → None
Reset a random stream
-
set_seed(new_seed) → None
Set the seed of a random stream to a specific number
- Parameters:
new_seed (int32) –