Vim script has no native support for random numbers, so we need a cross platform (Linux, Mac OS, Windows) solution for generating them.
This is my current implementation of a random function, although it is based on time so it's not giving great results.
function! Randnum(max) abort
return str2nr(matchstr(reltimestr(reltime()), '\v\.@<=\d+')[1:]) % a:max
endfunction
Vim script has no native support for random numbers, so we need a cross platform (Linux, Mac OS, Windows) solution for generating them.
This is my current implementation of a random function, although it is based on time so it's not giving great results.