1.0.3 • Published 10 months ago

@rbxts/debug-random v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

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)))
1.0.3

10 months ago

1.0.2

10 months ago

1.0.1

12 months ago