From c97614d98fc7ab040851b7fe1bc4cb575ce8c627 Mon Sep 17 00:00:00 2001 From: Sean Dewar Date: Sun, 9 Jan 2022 23:26:03 +0000 Subject: vim-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 vim/vim#5279) https://github.com/vim/vim/commit/f8c1f9200c4b50969a8191a4fe0b0d09edb38979 --- runtime/doc/builtin.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 8d88c533f0..327b8dc4d9 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -5533,7 +5533,7 @@ range({expr} [, {max} [, {stride}]]) *range()* GetExpr()->range() < 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 @@ -7200,11 +7200,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() -- cgit