So as the title says, this problem is only seen on mobile, it works perfectly on PC
It also only happens if the seed(see code below) is negative, it works fine otherwise
I’ll explain more in a briefing
So this is a simplified version of the code:
-- This is a module script in ReplicatedStorage
-- These are example numbers
local Randomseed = -1000 -- Negative seed
local totalWeight = 15000
function module:Initiate(x, y) -- This mobule is always called with different arguments
local random = Random.new(x + Randomseed .. math.abs(y + Randomseed))
local RandomNumber = random:NextInteger(1, totalWeight)
-- THE "RANDOMNUMBER" VARIABLE IS THE ONE WHICH IS ALWAYS THE SAME
print(RandomNumber, "Coordinates: ", x, y)
end
I understand that Nextinteger is a pseudorandom number generator, but everytime it’s called, it’s called with a different x and y value(See script underneath and screenshots)
The script that calls the function numerous times:
-- This is a local script in StarterPlayerScripts, which calls the module script
local ModuleScript = require(game.ReplicatedStorage.ModuleScript)
local Range = 5
local function Activate()
for x = -Range, Range do
for y = -Range, Range do
ModuleScript:Initiate(x, y)
end
end
end
Activate()
Now on pc, the “RandomNumber” Variable prints different everytime, on mobile, however, it prints the same number over and over again
Proof:
PC:
Mobile:
There is simply no reason for it not to work on mobile but work fine on pc, so i highly doubt this is on my side
REPRODUCTION STEPS:
The game: Roblox Bug Reports - Roblox
The game file: Roblox Bug Reports.rbxl (43.9 KB)
This happens on all games, 100% of the time (that is if the circumstances are correct, like negative seed and on mobile)
This has started since i implemented the code
If you want to make an empty baseplate yourself and test this, use the scripts above and the instructions below:
The module script must be in ReplicatedStorage
The activation script must be in StarterPlayerScripts