From 739a87af0a9209f99458a3b7d59154488bd43d81 Mon Sep 17 00:00:00 2001 From: Yuri Sequoia <39732771+yurisequoia@users.noreply.github.com> Date: Wed, 4 Feb 2026 18:42:18 +0800 Subject: [PATCH] fix(uuid): resolve duplicate UUID generation by improving random seeding (#1473) - Moved math.randomseed() from the generation function to the initialization phase. - Replaced os.time() with a more precise seed (os.time + os.clock) to prevent identical sequences when calls occur within the same second. --- lua/uuid.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/uuid.lua b/lua/uuid.lua index 7659323..cf8dc30 100644 --- a/lua/uuid.lua +++ b/lua/uuid.lua @@ -33,12 +33,12 @@ end local M = {} function M.init(env) + randomseed(os.time() + os.clock() * 1000) M.uuid = env.engine.schema.config:get_string(env.name_space:gsub("^*", "")) or "uuid" end function M.func(input, seg, _) if input == M.uuid then - randomseed(os.time()) yield_cand(seg, generate_uuid_v4()) end end