Im confused on how the math.random function works, does it generate a number between x and y? can It check if a value is equal to 1,10? if not, is there a different function for it?
math.random() with no arguments generates a random double between 0 and 1 ((but not including 1).
math.random(x) generates a random int between 1 and x.
math.random(x, y) generates a random int between x and y.
Also note that for the second and third overloads, if the upper bound is not greater than the lower bound the function will throw an error.
As @kalabgs also explains, the Random class can do everything math.random() can do, with some extra functionality.
It generates integer between 1 and 10. While Random.new() has the ability to get numbers with decimals
Example:
print(math.random(1,10) -- will print integer between 1 and 10
local Randomizer = Random.new()
print(Randomizer:NextNumber(1,10)) -- will print decimal between 1 and 10
print(Randomizer:NextInteger(1,10)) -- same as math.random()