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

Math.random is broken?

Hey everyone, im with a question here.

I've made a motherload, and it generates a random field every time i launch a game on test-mode. However, When i play it in normal mode (Play on the site) it always generates the same terrain.

Does anyone know if this is a known bug or something that could be wrong? The math.random goes from -30000 to 6250.

1 comment

0

Did you try setting a randomseed?

1 answer

Well, when I ran the code print(math.random(-30000,6250)) in studio, I got the following output:

--[[
> print(math.random(-30000,6250))
-17271
> print(math.random(-30000,6250))
-7835
> print(math.random(-30000,6250))
-3540
> print(math.random(-30000,6250))
3027
> print(math.random(-30000,6250))
-5261
> print(math.random(-30000,6250))
-16017
--]]

Since this does seem random, I believe that your problem lies not with math.random but with some other part of your code.

2 comments

0

no, i mean that it always comes out the same on multi player, create a place with this (ive also done that), it will always come at the same values

0

No, it works exactly the same in online mode. I just tested it.

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