Skip to content

feat(random): add rnd() to mimic math.random()#83

Closed
Tieske wants to merge 3 commits intomasterfrom
feat/rnd
Closed

feat(random): add rnd() to mimic math.random()#83
Tieske wants to merge 3 commits intomasterfrom
feat/rnd

Conversation

@Tieske
Copy link
Member

@Tieske Tieske commented Feb 13, 2026

Matches Lua 5.4+ implementation. But uses crypto secure random data.

The system.random function only returns bytes. This function is a drop in replacement for math.random (except that is uses 5.4+ semantics).

Lua 5.4 added a case where math.random(0) behaves differently (see manual).

@Tieske
Copy link
Member Author

Tieske commented Feb 16, 2026

Closing this for now. Due to handling version differences between Lua 5.1 to 5.5 versions this became more complex than anticipated.

Leaving the branch around just in case.

@Tieske Tieske closed this Feb 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant