From 457891594361f8a315a4c05e303010a4bb9a0c9c Mon Sep 17 00:00:00 2001 From: ostermine Date: Fri, 6 Nov 2026 03:49:26 +0300 Subject: [PATCH] fix math.random seed being the same on every launch stdlib.lua runs from scripting::initialize before the main loop starts, so time.uptime() is still 0 there and math.randomseed(time.uptime() * 1536227939) is math.randomseed(0). math.random() gave the same sequence on every launch, and so did the random seed placeholder of the "New World" page: every world created without typing a seed got the same seed. Seed from time.precise_utc_time() instead. --- res/scripts/stdlib.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/res/scripts/stdlib.lua b/res/scripts/stdlib.lua index 97d4e0342..d21fc10c3 100644 --- a/res/scripts/stdlib.lua +++ b/res/scripts/stdlib.lua @@ -410,7 +410,7 @@ require("core:io_stream").wrap_bytearray = require "core:internal/stream_provide network.__as_stream = require "core:internal/stream_providers/socket" -math.randomseed(time.uptime() * 1536227939) +math.randomseed(time.precise_utc_time()) rules = require "core:internal/rules" time.schedules = {}