Created
October 3, 2011 11:14
-
-
Save ynkdir/1258905 to your computer and use it in GitHub Desktop.
crasn with setting &lines and &columns
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" $ vim -u NONE -g -S thisfile.vim | |
let s:RAND_MAX = 32767 | |
let s:seed = 0 | |
function! s:rand() | |
let s:seed = s:seed * 214013 + 2531011 | |
return (s:seed < 0 ? s:seed - 0x80000000 : s:seed) / 0x10000 % 0x8000 | |
endfunction | |
function! s:random() | |
return s:rand() / (s:RAND_MAX * 1.0) | |
endfunction | |
" Return a random integer N such that a <= N <= b. | |
function s:randint(a, b) | |
return float2nr(a:a + ((a:b - a:a + 1) * s:random())) | |
endfunction | |
while 1 | |
let &columns = s:randint(1, 1000) | |
let &lines = s:randint(1, 1000) | |
endwhile |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment