Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how do I randomize between 0-100?

Asked by 5 years ago
local RandomNum = math.random(1,100)

I for some reason cant use 0-100 so I can Only do this. Also im heavily new to coding.

2
Self answered question? xPolarium 1388 — 5y
0
idk, they said that hes new to coding. EliteRayGawnX2 124 — 5y
2
math.random(0,100) works though. EzraNehemiah_TF2 3552 — 5y

2 answers

Log in to vote
0
Answered by 5 years ago

You can add,subtract,multiply, and divide like so:

local RandomNum = math.random(1,101) - 1
0
Why not just do math.random(0,100) LOL DaCrazyDev 444 — 5y
1
Do `local RandomNum = math.random(0,100)` instead. EzraNehemiah_TF2 3552 — 5y
0
that's what I just said xD DaCrazyDev 444 — 5y
0
Where does the multiplication, addition, and division come in? User#21908 42 — 5y
View all comments (3 more)
0
multiplication: local a = 1 local b = 2 local problem = a * b print(problem) Output: 2 namespace25 594 — 5y
0
division: local a = 2 local b = 10 local problem = b / a print(problem) Output: 5 namespace25 594 — 5y
0
addition: local a = 2 local b = 2 local problem = a + b print(problem) Output: 4 namespace25 594 — 5y
Ad
Log in to vote
0
Answered by 5 years ago
local RandomNum = math.random(0,100)

Answer this question