Forest Logo
search
package_2

debug-random

By @tim7775

Roblox

Mirrored

DebugRandom

A wrapper around Roblox's Random class that enables users to serialize and set the state of the Random object.

Get it here:

Documentation

View Documentation

Usage

Example use: Serialize a random number generator's state when an error occurs, so the error can be replicated using DebugRandom:SetSerializedState or DebugRandom.deserialize.

local rng = DebugRandom.new()
print(rng:NextNumber())

local state = rng:Serialize()
local deserializedRng = DebugRandom.deserialize(state)
assert(rng == deserializedRng)
assert(rng:NextNumber() == deserializedRng:NextNumber())
assert(rng == DebugRandom.fromString(tostring(rng)))

Package Details

Install command (Click to copy)


Version

1.0.3

License

MIT

check_circle

Safe for commercial use

Automated license review — not legal advice.