From 5ae3ca059aa189401af6973c4e18f601fa265d15 Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Tue, 7 Dec 2021 02:24:50 -0800 Subject: [PATCH] Fixed old references additive 55 Fixed documentation that referred to the old additive 55 generator. We have been using the subtractive 100 in place of the additive 55 generator for a while now. --- CHANGES | 4 ++++ cal/regress.cal | 4 ++-- custom/c_argv.c | 2 +- custom/c_sysinfo.c | 2 +- func.c | 8 ++++---- help/isrand | 9 +++++---- help/randbit | 6 +++--- help/random | 2 +- help/randombit | 4 ++-- help/seed | 2 +- opcodes.h | 2 +- symbol.c | 2 +- value.h | 4 ++-- zrand.c | 2 +- 14 files changed, 29 insertions(+), 24 deletions(-) diff --git a/CHANGES b/CHANGES index 424b8d8..3869b8b 100644 --- a/CHANGES +++ b/CHANGES @@ -19,6 +19,10 @@ The following are the changes from calc version 2.14.0.11 to date: is an valid external symbol. + Fixed documentation that referred to the old additive 55 + generator. We have been using the subtractive 100 in place + of the additive 55 generator for a while now. + The following are the changes from calc version 2.14.0.9 to 2.14.0.10: diff --git a/cal/regress.cal b/cal/regress.cal index d6ca9e1..c6501b6 100644 --- a/cal/regress.cal +++ b/cal/regress.cal @@ -1720,7 +1720,7 @@ define test_rand() print '1503: state0 = srand(0)'; vrfy(state0 == init, '1504: state0 == init'); - /* test the additive 55 shuffle generator */ + /* test the subtractive 100 shuffle generator */ tmp = srand(0); print '1505: tmp = srand(0)'; vrfy(rand() == 0x1fe5b46fba7e069d, \ @@ -4750,7 +4750,7 @@ define test_random() print '5303: state0 = srandom(0)'; vrfy(state0 == init, '5304: state0 == init'); - /* test the additive 55 shuffle generator */ + /* test the subtractive 100 shuffle generator */ tmp = srandom(0); print '5305: tmp = srandom(0)'; vrfy(random() == 0x7fb838a8a0a95046, \ diff --git a/custom/c_argv.c b/custom/c_argv.c index 10aaa45..4a73246 100644 --- a/custom/c_argv.c +++ b/custom/c_argv.c @@ -108,7 +108,7 @@ c_argv(char *UNUSED(name), int count, VALUE **vals) case V_FILE: /* opened file id */ type = "file"; break; - case V_RAND: /* address of additive 55 random state */ + case V_RAND: /* subtractive 100 random state */ type = "rand_state"; break; case V_RANDOM: /* address of Blum random state */ diff --git a/custom/c_sysinfo.c b/custom/c_sysinfo.c index 3b3897d..5192697 100644 --- a/custom/c_sysinfo.c +++ b/custom/c_sysinfo.c @@ -208,7 +208,7 @@ STATIC struct infoname sys_info[] = { (FULL)SBITS}, {"SBYTES", "size of additive or shuffle entry in bytes", NULL, (FULL)SBYTES}, - {"SCNT", "length of additive 55 table in FULLs", NULL, + {"SCNT", "length of subtractive 100 table in FULLs", NULL, (FULL)SCNT}, {"SEEDXORBITS", "low bits of a55 seed devoted to xor", NULL, (FULL)SEEDXORBITS}, diff --git a/func.c b/func.c index b766f85..02d8fb5 100644 --- a/func.c +++ b/func.c @@ -1048,7 +1048,7 @@ f_srand(int count, VALUE **vals) break; case V_MAT: - /* load additive 55 table and return previous state */ + /* load subtractive 100 table and return prev state */ result.v_rand = zsrand(NULL, vals[0]->v_mat); break; @@ -10203,7 +10203,7 @@ STATIC CONST struct builtin builtins[] = { {"isqrt", 1, 1, 0, OP_NOP, qisqrt, 0, "integer part of square root"}, {"isrand", 1, 1, 0, OP_ISRAND, 0, 0, - "whether a value is a additive 55 state"}, + "whether a value is a subtractive 100 state"}, {"israndom", 1, 1, 0, OP_ISRANDOM, 0, 0, "whether a value is a Blum state"}, {"isreal", 1, 1, 0, OP_ISREAL, 0, 0, @@ -10367,9 +10367,9 @@ STATIC CONST struct builtin builtins[] = { {"r2g", 1, 2, 0, OP_NOP, 0, f_r2g, "convert radians to gradians"}, {"rand", 0, 2, 0, OP_NOP, f_rand, 0, - "additive 55 random number [0,2^64), [0,a), or [a,b)"}, + "subtractive 100 random number [0,2^64), [0,a), or [a,b)"}, {"randbit", 0, 1, 0, OP_NOP, f_randbit, 0, - "additive 55 random number [0,2^a)"}, + "subtractive 100 random number [0,2^a)"}, {"random", 0, 2, 0, OP_NOP, f_random, 0, "Blum-Blum-Shub random number [0,2^64), [0,a), or [a,b)"}, {"randombit", 0, 1, 0, OP_NOP, f_randombit, 0, diff --git a/help/isrand b/help/isrand index 1f18558..9a9415a 100644 --- a/help/isrand +++ b/help/isrand @@ -1,5 +1,5 @@ NAME - isrand - whether a value is an additive 55 state + isrand - whether a value is an subtractive 100 state SYNOPSIS isrand(x) @@ -10,8 +10,9 @@ TYPES return int DESCRIPTION - Determine if x is an additive 55 pseudo-random number generator state. - This function will return 1 if x is a file, 0 otherwise. + Determine if x is an subtractive 100 pseudo-random number + generator state. This function will return 1 if x is a file, + 0 otherwise. EXAMPLE ; a = srand(0) @@ -31,7 +32,7 @@ SEE ALSO isobjtype, isodd, isprime, israndom, isreal, isrel, issimple, issq, isstr, istype -## 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/randbit b/help/randbit index 4e2e489..3b4d792 100644 --- a/help/randbit +++ b/help/randbit @@ -1,4 +1,4 @@ -NAME + randbit - subtractive 100 shuffle pseudo-random number generator SYNOPSIS @@ -23,7 +23,7 @@ DESCRIPTION If x is omitted, it is assumed to have the value of 1. - See the rand() help page for details on the additive 55 shuffle + See the rand() help page for details on the subtractive 100 shuffle pseudo-random number generator. EXAMPLE @@ -42,7 +42,7 @@ LINK LIBRARY SEE ALSO seed, srand, randbit, isrand, random, srandom, israndom -## Copyright (C) 1999,2018 Landon Curt Noll +## Copyright (C) 1999,2018,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/random b/help/random index 024dabc..221d430 100644 --- a/help/random +++ b/help/random @@ -20,7 +20,7 @@ DESCRIPTION While the Blum-Blum-Shub generator is not painfully slow, it is not a fast generator. For a faster, but lesser quality generator - (non-cryptographically strong) see the additive 55 generator + (non-cryptographically strong) see the subtractive 100 generator (see the rand help page). Other arg forms: diff --git a/help/randombit b/help/randombit index ac00756..9a9c5f3 100644 --- a/help/randombit +++ b/help/randombit @@ -23,7 +23,7 @@ DESCRIPTION If x is omitted, it is assumed to have the value of 1. - See the random() help page for details on the additive 55 shuffle + See the random() help page for details on the subtractive 100 shuffle pseudo-random number generator. EXAMPLE @@ -41,7 +41,7 @@ LINK LIBRARY SEE ALSO seed, srand, randbit, isrand, rand, 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/seed b/help/seed index 1bac5b4..1116158 100644 --- a/help/seed +++ b/help/seed @@ -33,7 +33,7 @@ EXAMPLE RAND state ; print srandom(seed()) - RAND state + RANDOM state LIMITS none diff --git a/opcodes.h b/opcodes.h index fc077ad..406bfee 100644 --- a/opcodes.h +++ b/opcodes.h @@ -143,7 +143,7 @@ #define OP_ELEMINIT 102L /* assign element of matrix or object */ #define OP_ISCONFIG 103L /* whether value is a configuration state */ #define OP_ISHASH 104L /* whether value is a hash state */ -#define OP_ISRAND 105L /* whether value is additive 55 random state */ +#define OP_ISRAND 105L /* whether value is subtractive 100 state */ #define OP_ISRANDOM 106L /* whether value is a Blum random state */ #define OP_SHOW 107L /* show data about current state */ #define OP_INITFILL 108L /* fill new matrix with copies of a value */ diff --git a/symbol.c b/symbol.c index 64ca7e9..758c00b 100644 --- a/symbol.c +++ b/symbol.c @@ -285,7 +285,7 @@ printtype(VALUE *vp) s = "file id"; break; case V_RAND: - s = "additive 55 random state"; + s = "subtractive 100 random state"; break; case V_RANDOM: s = "Blum random state"; diff --git a/value.h b/value.h index 2ff1321..34148a1 100644 --- a/value.h +++ b/value.h @@ -96,7 +96,7 @@ struct value { ASSOC *vv_assoc; /* 8: address of association */ OBJECT *vv_obj; /* 9: address of object */ FILEID vv_file; /* 10: id of opened file */ - RAND *vv_rand; /* 11: additive 55 random state */ + RAND *vv_rand; /* 11: subtractive 100 random state */ RANDOM *vv_random; /* 12: Blum random state */ CONFIG *vv_config; /* 13: configuration state */ HASH *vv_hash; /* 14: hash state */ @@ -156,7 +156,7 @@ struct value { #define V_ASSOC 8 /* address of association structure */ #define V_OBJ 9 /* address of object structure */ #define V_FILE 10 /* opened file id */ -#define V_RAND 11 /* address of additive 55 random state */ +#define V_RAND 11 /* address of subtractive 100 random state */ #define V_RANDOM 12 /* address of Blum random state */ #define V_CONFIG 13 /* configuration state */ #define V_HASH 14 /* hash state */ diff --git a/zrand.c b/zrand.c index 7afe795..88d9e47 100644 --- a/zrand.c +++ b/zrand.c @@ -69,7 +69,7 @@ * all magic numbers are explained * * I distrust systems with constants (magic numbers) and tables - * that have no justification (e.g., DES). I believe that I have + * that have no justification. I believe that I have * done my best to justify all of the magic numbers used. * * full documentation