Jump to content

Help generating random numbers in Lua with the math library


j03l1370

Recommended Posts

Hi, I am trying to generate a random number in a range with the function

math.random()

and when i use the math library it gives me the error that is in the image.
I think it could be some sort of problem with Java and the way it interpret Lua but i'm not really sure if could be that

rado errror.png

Link to comment
Share on other sites

  • 3 weeks later...
On 3/31/2023 at 3:04 PM, j03l1370 said:

Hi, I am trying to generate a random number in a range with the function

math.random()

and when i use the math library it gives me the error that is in the image.
I think it could be some sort of problem with Java and the way it interpret Lua but i'm not really sure if could be that


I found some info on the internet. Maybe this will help you. First you need to include the "math" module with the "require('math')" command. You can then use the "math.random()" function, which will generate a random number between 0 and 1. Also searched for mathematics, and used https://phdessay.com/free-essays-on/mathematics/ to more detailed knowledge. If you have any questions or problems, feel free to ask for help! I really enjoy helping people. I feel after the news that I helped someone is simply unrealistic. Even if I do not understand this, I am ready to read and find out what you need.

rado errror.png

require('math')  will help?

Edited by DaveGT
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...