Mercurial > vim
diff runtime/doc/eval.txt @ 18732:2513e666aa82 v8.1.2356
patch 8.1.2356: rand() does not use the best algorithm
Commit: https://github.com/vim/vim/commit/f8c1f9200c4b50969a8191a4fe0b0d09edb38979
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Nov 28 22:13:14 2019 +0100
patch 8.1.2356: rand() does not use the best algorithm
Problem: rand() does not use the best algorithm.
Solution: use xoshiro128** instead of xorshift. (Kaito Udagawa,
closes #5279)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 28 Nov 2019 22:15:04 +0100 |
parents | 99586852c2db |
children | 8dde7ced3344 |
line wrap: on
line diff
--- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 8.1. Last change: 2019 Nov 25 +*eval.txt* For Vim version 8.1. Last change: 2019 Nov 28 VIM REFERENCE MANUAL by Bram Moolenaar @@ -7641,7 +7641,7 @@ range({expr} [, {max} [, {stride}]]) < rand([{expr}]) *rand()* - Return a pseudo-random Number generated with an xorshift + Return a pseudo-random Number generated with an xoshiro128** algorithm using seed {expr}. The returned number is 32 bits, also on 64 bits systems, for consistency. {expr} can be initialized by |srand()| and will be updated by @@ -9150,11 +9150,11 @@ sqrt({expr}) *sqrt()* srand([{expr}]) *srand()* Initialize seed used by |rand()|: - If {expr} is not given, seed values are initialized by - time(NULL) a.k.a. epoch time. This only has second - accuracy. - - If {expr} is given, return seed values which x element is - {expr}. This is useful for testing or when a predictable - sequence is expected. + reading from /dev/urandom, if possible, or using time(NULL) + a.k.a. epoch time otherwise; this only has second accuracy. + - If {expr} is given it must be a Number. It is used to + initialize the seed values. This is useful for testing or + when a predictable sequence is intended. Examples: > :let seed = srand()