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

How to get a bigger pool of numbers with math.random?

How can I use math.random to get a number from multiple pools? I mean could I use it to get something between 1,3 and 6,9? Giving me 1, 2, 3, 6, 7, 8 or 9? I'm not quite sure how to explain this but it would be very useful

6 comments

0

Have two math.randoms?

0

No... I mean lets say I want A to = 1, 2, 3 6,7,8 or 9...

0

yea, use two math.randoms, or use a table

0

How would I use two math.randoms here? Explain..

0

I'll answer.

0

I'm closing this as a duplicate with a hopefully helpful answer. If you have a more specific question, feel free to ask that as a new question.

1 answer

I would use a table. The math.random idea I had in the comments might be done like this.

math.randomseed(tick())--seed

wait(math.rad(math.random(40,100)))--random waiting

nums = {
	math.random(1,3), --nums
	math.random(6,9)
}

num = math.random(1,#nums) -- full num

print(num) -- print num

Uses both a table and multiple randoms.

3 comments

0

Doesn't work...

0

Really? worked for me.... Is it a server script?

0

The problem comes in if I don't want the number 1. The issue is on line #10 I believe

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