Skip to content

Fixed Random

Struct · FFixedRandom

#include "Types/Random.h"

deterministic: safe in simulation code

Deterministic RNG state using Xorshift128+ algorithm. Guaranteed to produce identical results across all platforms.

C++ members (27)
  • void SetSeed(uint64 Seed); Initialize RNG with a seed value. Uses SplitMix64 to generate initial state from seed.
  • void GetState(uint64& OutState0, uint64& OutState1) const; Get the current state for serialization/debugging.
  • void SetState(uint64 InState0, uint64 InState1); Set the current state for deserialization.
  • uint64 Next64(); Generate next random uint64 value using Xorshift128+. This is the core function - all other random functions build on this.
  • uint32 Next32(); Generate next random uint32 value.
  • int32 Int(); Generate random int32 value.
  • int64 Int64(); Generate random int64 value.
  • FFixedPoint FixedPoint(); Generate random FFixedPoint in range [0, 1).
  • bool Bool(); Generate random boolean (50/50 chance).
  • bool Bool(FFixedPoint Probability); Generate random boolean with probability (0 to 1). Returns true with given probability.
  • FFixedPoint Range(FFixedPoint Min, FFixedPoint Max); Generate random FFixedPoint in range [Min, Max].
  • int32 IntRange(int32 Min, int32 Max); Generate random int32 in range [Min, Max] (inclusive).
  • FFixedVector2D PointInCircle(FFixedVector2D Centre, FFixedPoint Radius, FFixedVector Normal = FFixedVector::UpVector); Generate random 2D point inside a circle.
  • FFixedVector PointInSphere(FFixedVector Centre, FFixedPoint Radius); Generate random 3D point inside a sphere.
  • FFixedVector2D PointInRect(FFixedVector2D Centre, FFixedVector2D HalfExtents, FFixedVector Normal = FFixedVector::UpVector); Generate random 2D point inside a rectangle.
  • FFixedVector PointInBox(FFixedVector Centre, FFixedVector HalfExtents); Generate random 3D point inside a box.
  • FFixedVector2D InsideUnitCircle(); Generate random 2D point inside unit circle.
  • FFixedVector2D OnUnitCircle(); Generate random unit 2D vector.
  • FFixedVector InsideUnitSphere(); Generate random 3D point inside unit sphere.
  • FFixedVector OnUnitSphere(); Generate random unit 3D vector.
  • FFixedPoint Yaw(); Generate random rotation (yaw only, for ground units).
  • FFixedPoint Pitch(); Generate random pitch rotation.
  • FFixedPoint Roll(); Generate random roll rotation.
  • FFixedRotator RandomRotator(); Generate a random degree-based rotator. Pitch(), Yaw(), and Roll() intentionally expose radians; convert at this type boundary because FFixedRotator stores degrees.
  • bool operator==(const FFixedRandom& Other) const;
  • bool operator!=(const FFixedRandom& Other) const;
  • FString ToString() const;