From 0d31eb6828b21bf1590882af1971186e11656d25 Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Thu, 9 Dec 2021 01:34:58 -0800 Subject: [PATCH] Recommend calling srand() or srandom() with seed() --- help/srand | 7 ++++++- help/srandom | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/help/srand b/help/srand index 25d3ca4..abbbf3a 100644 --- a/help/srand +++ b/help/srand @@ -12,6 +12,11 @@ TYPES DESCRIPTION Seed the pseudo-random number using an subtractive 100 shuffle generator. + It you want a quick and effective way to seed the generator, + we recommended that you call srand() with the seed() value: + + srand(seed()) + For integer seed != 0: Any buffered rand generator bits are flushed. The subtractive table @@ -150,7 +155,7 @@ LINK LIBRARY SEE ALSO seed, srandom, randbit, isrand, random, srandom, israndom -## Copyright (C) 1999 Landon Curt Noll +## Copyright (C) 1999,2021 Landon Curt Noll ## ## Calc is open software; you can redistribute it and/or modify it under ## the terms of the version 2.1 of the GNU Lesser General Public License diff --git a/help/srandom b/help/srandom index 43966a9..47b61cf 100644 --- a/help/srandom +++ b/help/srandom @@ -20,6 +20,11 @@ TYPES DESCRIPTION Seed the pseudo-random number using the Blum-Blum-Shub generator. + It you want a quick and effective way to seed the generator, + we recommended that you call srandom() with the seed() value: + + srandom(seed()) + There are two primary values contained inside generator state: Blum modulus: @@ -58,7 +63,7 @@ DESCRIPTION call of srandom(0) will restore the generator to the state found when calc starts. - 1 arg (seed >= 2^32): srandom(21609139158123209^9+17) + 1 arg (seed >= 2^32): srandom(seed()) The seed value is used to compute the new quadratic residue. The seed passed will be successively squared mod the Blum