Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How Would You Pull a Random Variable from an Array?

I have the array "array1 = {1, 2, 3}", and I'd like to pull a random variable from the table. math.random seems to give me the same sequence of numbers, constantly, rather than being random. Any idea how to make it truly random?

1 answer

✓ Accepted answer
array1[math.random(1, #array1)]

3 comments

0

Gives me 1 every time.

0

It works. Keep testin' it.

0

Mm. Must've been giving me 1 every time by random chance, tried it again and it works.

This discussion is preserved as it was. New answers, comments, and votes are closed.