Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LuaForWindows_v5.1.4-46 #131

Open
mahdi-hajian opened this issue Dec 11, 2020 · 2 comments
Open

LuaForWindows_v5.1.4-46 #131

mahdi-hajian opened this issue Dec 11, 2020 · 2 comments

Comments

@mahdi-hajian
Copy link

math.random() is wrong

for example
math.random(200)
is only 1
or
math.random(200,300)
is only 200

@mahdi-hajian
Copy link
Author

in last version is wrong too
Lua for Windows v5.1.5-52 Released

@TFWol
Copy link

TFWol commented Mar 6, 2023

That's a lua problem.

-- you only get 200
count = 0
while count < 100 do
  number = math.random(200, 300)
  print(number)
  if number == 200 then
    break
  end
  count = count + 1
end
-- works properly
math.randomseed(os.time())

count = 0
while count < 100 do
  number = math.random(200, 300)
  print(number)
  if number == 200 then
    break
  end
  count = count + 1
end

REF:
https://stackoverflow.com/questions/18199844/lua-math-random-not-working

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

No branches or pull requests

2 participants