diff --git a/lua/org-roam/core/utils/random.lua b/lua/org-roam/core/utils/random.lua index 5c7bea8..6a0e82f 100644 --- a/lua/org-roam/core/utils/random.lua +++ b/lua/org-roam/core/utils/random.lua @@ -6,11 +6,17 @@ ---@class org-roam.core.utils.Random local M = {} +local seeded = false ---@param m integer ---@param n integer ---@return integer function M.random(m, n) + if seeded == false then + -- https://www.lua-users.org/wiki/MathLibraryTutorial + math.randomseed(tonumber(tostring(os.time()):reverse():sub(1,6))) + seeded = true + end return math.random(m, n) end