Add new neovim welcome screen and change probability definitions
This commit is contained in:
parent
1ea00e644d
commit
949e930a56
@ -4,7 +4,7 @@
|
||||
local function clamp(x, min, max) return math.max(math.min(x, max), min) end
|
||||
|
||||
local function get_random_image()
|
||||
images = {
|
||||
local images = {
|
||||
{
|
||||
[[██╗ █████╗ ██████╗██╗ ██╗███████╗]],
|
||||
[[██║ ██╔══██╗██╔════╝██║ ██║██╔════╝]],
|
||||
@ -29,21 +29,53 @@ local function get_random_image()
|
||||
[[██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║]],
|
||||
[[██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║]],
|
||||
[[╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝]]
|
||||
},
|
||||
{
|
||||
[[ ▄ ]],
|
||||
[[ ▟█▙ ]],
|
||||
[[ ▟███▙ ]],
|
||||
[[ ▟█████▙ ]],
|
||||
[[ ▟███████▙ ]],
|
||||
[[ ▂▔▀▜██████▙ ]],
|
||||
[[ ▟██▅▂▝▜█████▙ ]],
|
||||
[[ ▟█████████████▙ ]],
|
||||
[[ ▟███████████████▙ ]],
|
||||
[[ ▟█████████████████▙ ]],
|
||||
[[ ▟███████████████████▙ ]],
|
||||
[[ ▟█████████▛▀▀▜████████▙ ]],
|
||||
[[ ▟████████▛ ▜███████▙ ]],
|
||||
[[ ▟█████████ ████████▙ ]],
|
||||
[[ ▟██████████ █████▆▅▄▃▂ ]],
|
||||
[[ ▟██████████▛ ▜█████████▙ ]],
|
||||
[[ ▟██████▀▀▀ ▀▀██████▙ ]],
|
||||
[[ ▟███▀▘ ▝▀███▙ ]],
|
||||
[[▟▛▀ ▀▜▙]],
|
||||
[[ btw ]]
|
||||
}
|
||||
}
|
||||
|
||||
local i = 3
|
||||
local pmf = {0.25, 0.25, 0.25, 0.25}
|
||||
local cdf = {}
|
||||
|
||||
cdf[1] = 0
|
||||
for j = 2, #pmf+1 do
|
||||
cdf[j] = cdf[j - 1] + pmf[j - 1]
|
||||
end
|
||||
|
||||
if math.abs(cdf[#cdf] - 1) > 0.01 then
|
||||
error("Probabilities do not add up to 1")
|
||||
elseif #images ~= #pmf then
|
||||
error("Number of images and probabilities do not match")
|
||||
end
|
||||
|
||||
math.randomseed(os.time())
|
||||
if math.fmod(math.random(100), 5) == 0 then
|
||||
if math.random(0, 1) == 0 then
|
||||
i = 1
|
||||
else
|
||||
i = 2
|
||||
end
|
||||
end
|
||||
local r = math.random(100)
|
||||
|
||||
return images[i]
|
||||
for j = 2, #cdf do
|
||||
if r <= cdf[j] * 100 then
|
||||
return images[j-1]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-----------------
|
||||
|
||||
Loading…
Reference in New Issue
Block a user