diff options
| author | Teddy Wing | 2015-10-06 04:22:01 -0400 | 
|---|---|---|
| committer | Teddy Wing | 2015-10-06 04:23:25 -0400 | 
| commit | e2a889845f32a6f8538038d398a6fc8a0a17576e (patch) | |
| tree | c0e42c69c6c65aa67d67220d5d6e468cc6fb4bc4 | |
| parent | 1307eacc9e6aff2213f909d3c30fdfb15c6c8050 (diff) | |
| download | vim-space-vlaze-e2a889845f32a6f8538038d398a6fc8a0a17576e.tar.bz2 | |
random.vim: Use :ruby
Since `:python` didn't work out for me because of my system version
mismatch (1307eac), use Ruby to generate random numbers instead.
And w00t! this doesn't block the interface, rendering, and player
movement!
| -rw-r--r-- | autoload/space_vlaze/random.vim | 9 | 
1 files changed, 4 insertions, 5 deletions
| diff --git a/autoload/space_vlaze/random.vim b/autoload/space_vlaze/random.vim index aef422d..9264be1 100644 --- a/autoload/space_vlaze/random.vim +++ b/autoload/space_vlaze/random.vim @@ -3,11 +3,10 @@  " From:  " http://vi.stackexchange.com/questions/807/how-to-generate-random-numbers/812#812  function! space_vlaze#random#Random(max) -	python << EOS -import random -import vim -r = random.randint(0, vim.eval('a:max')) -vim.command('let r = %d' % r) +	ruby << EOS +# Add 1 because rand() will choose a number < max and we want <= max +r = rand(VIM::evaluate('a:max') + 1) +VIM::command('let r = %d' % r)  EOS  	return r  endfunction | 
