Get a random number from win32 cmd.exe

This commit is contained in:
Christian Brabandt 2019-03-26 21:53:47 +01:00
parent 4265798d4b
commit 86e73cade7
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09

View File

@ -229,6 +229,8 @@ function! s:rand(max) abort
if has("reltime")
let timerstr=reltimestr(reltime())
let number=split(timerstr, '\.')[1]+0
elseif has("win32") && &shell =~ 'cmd'
let number=system("echo %random%")+0
else
" best effort, bash and zsh provide $RANDOM
" cmd.exe on windows provides %random%, but expand()