> simple 16-bit random number generator
>
> Do you have a favorite?
Yeah, I know it's not what you've asked for, but I've been stung more
than once by use of "simple" random numbers and so I try to go much
further than "simple" if something better is handy, such as the
standard library. The following took less than the time to type this
post:
function! Random()
if !exists("s:seeded")
call libcallnr("libc.so.6", "srand", localtime() )
let s:seeded = 1
endif
return libcallnr("libc.so.6", "rand", 0 ) % 65536
endfun
You might have to adjust that "libc.so.6" for your OS.
Regards, John
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
No comments:
Post a Comment