You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’m using just the default way to generate IDs like timestamp-XXXX in obsidian.nvim.
I noticed that the “random” suffix is not actually random. Every time I restart Neovim, I get the exact same sequence of IDs when creating notes:
Example:
first note → timestamp-USPT
second → timestamp-CRIT
third → timestamp-LOCB
fourth → timestamp-ZSEZ
This sequence repeats consistently across sessions always same suffix.
From what I understand, this might be related to Lua’s math.random() using a fixed seed unless math.randomseed() is set. I fixed with math.randomseed(os.time() + vim.loop.hrtime()) in init.lua
Question
Is this the expected behavior in obsidian.nvim, or am I missing something in the setup?
Should the plugin handle random seeding internally, or is the recommended approach for users to manually call math.randomseed() in the Neovim config?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
I’m using just the default way to generate IDs like timestamp-XXXX in obsidian.nvim.
I noticed that the “random” suffix is not actually random. Every time I restart Neovim, I get the exact same sequence of IDs when creating notes:
Example:
first note → timestamp-USPT
second → timestamp-CRIT
third → timestamp-LOCB
fourth → timestamp-ZSEZ
This sequence repeats consistently across sessions always same suffix.
From what I understand, this might be related to Lua’s math.random() using a fixed seed unless math.randomseed() is set. I fixed with
math.randomseed(os.time() + vim.loop.hrtime())in init.luaQuestion
Is this the expected behavior in obsidian.nvim, or am I missing something in the setup?
Should the plugin handle random seeding internally, or is the recommended approach for users to manually call math.randomseed() in the Neovim config?
All reactions