Skip to content

Conversation

@wmltogether
Copy link
Contributor

Reference: https://www.lua.org/pil/18.html

The math.random function of the Lua standard library is different from the System.Random in C#.

Example: https://onecompiler.com/lua/43654vze4

local num = math.random()
  print ("math.random: no args: " .. num)

local num = math.random(4)
  print ("math.random: 1 args: " .. num)

local num = math.random(1, 3)
  print ("math.random: 2 args: " .. num)

Current (Lua-CShap):

math.random: no args: 0.93869702608793
math.random: 1 args: 1.2153242641
math.random: 2 args: 2.1235126233

Actual (Lua):

math.random: no args: 0.93869702608793
math.random: 1 args: 1
math.random: 2 args: 1

@nuskey8 nuskey8 merged commit d4cef6d into nuskey8:main Apr 14, 2025
@nuskey8
Copy link
Owner

nuskey8 commented Apr 14, 2025

Merged the PR. Thanks!

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