Skip to content

[Space Lua]: Implement math.random and math.randomseed#1845

Merged
zefhemel merged 2 commits intosilverbulletmd:mainfrom
mjf:space-lua-implement-math-randomseed
Feb 21, 2026
Merged

[Space Lua]: Implement math.random and math.randomseed#1845
zefhemel merged 2 commits intosilverbulletmd:mainfrom
mjf:space-lua-implement-math-randomseed

Conversation

@mjf
Copy link
Copy Markdown
Contributor

@mjf mjf commented Feb 20, 2026

Replace the Math.random() with a seedable xoshiro256** class LuaPRNG matching Lua semantics. Argument validation is in LuaPRNG class keeping math.ts a passthrough. State is seeded with 16 warmup discards as required by the xoshiro256** specification.

mjf added 2 commits February 20, 2026 13:14
Replace the `Math.random()` with a seedable `xoshiro256**` class
`LuaPRNG` matching Lua semantics.  Argument validation is in `LuaPRNG`
class keeping `math.ts` a passthrough.  State is seeded with 16 warmup
discards as **required** by the `xoshiro256**` specification.

Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
@zefhemel zefhemel merged commit 3bb80ec into silverbulletmd:main Feb 21, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants