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

How to achieve true random?

Asked by
zomspi 541 Moderation Voter
4 years ago

Roblox's math.random works, but it isn't really random, is there any way I can achieve true random?

1
What do you mean isn't really random ? Nguyenlegiahung 1091 — 4y
0
I've never had any problem using math.random. What exactly are you trying to do? ScuffedAI 435 — 4y
0
I think I've heard people saying math.randomseed(tick()) also increases the randomizing process? killerbrenden 1537 — 4y

1 answer

Log in to vote
2
Answered by 4 years ago
Edited 4 years ago

In order to achieve true randomization, simply use Random.new()

Random is the new way of finding completely random numbers.

using a variable for it, you can set it to use Numbers or Integers.

local var1 = Random.new()

var1:NextInteger(min,max) -- gives whole numbers only

var1:NextNumber(min,max) -- gives negatives,decimals,whole numbers, etc.

Sources:

http://developer.roblox.com/en-us/api-reference/datatype/Random

http://devforum.roblox.com/t/a-random-feature/64517

http://devforum.roblox.com/t/math-randomseed-seemingly-broken/96945

0
How great! I always used math.random and division to get decimals. EmK530 143 — 4y
Ad

Answer this question