Closed quantum-booty closed 3 years ago
it turns out lua's rng sucks. you can fix this behavior by updating the seed with some external source of entropy, this snippet uses os time
math.randomseed(os.time())
local colours = {'cyan', 'red', 'yellow', 'orange', 'magenta', 'white', 'violet', 'lightyellow', 'seagreen', 'slateblue'}
local function random_colours(colours_list)
return math.random(1, #colours_list)
end
it turns out lua's rng sucks. you can fix this behavior buy updating the seed with some external source of entropy, this snippet uses os time
math.randomseed(os.time()) local colours = {'cyan', 'red', 'yellow', 'orange', 'magenta', 'white', 'violet', 'lightyellow', 'seagreen', 'slateblue'} local function random_colours(colours_list) return math.random(1, #colours_list) end
Thank you this works :)
I want to generate a new dashboard colour at every vim start. I wrote this script but apparently the random_colours function generates the same colour everytime I start vim.
The whole config is here: