Answers for "lua math.random"

Lua
6

how to get a random number in lua

local randomNumber1 = math.random(1, 10) --Returns a number between 1 and 10.
local randomNumber2 = math.random(10) --Also returns a number between 1 and 10.

print(randomNumber1, randomNumber2) --OUTPUT EXAMPLE: "6, 8"
Posted by: Guest on December-29-2020
2

lua math.random

local M = math.random(1,2) --Input you number

print(M)
Posted by: Guest on September-06-2020

Browse Popular Code Answers by Language