mirror of
https://github.com/lcn2/calc.git
synced 2025-08-16 01:03:29 +03:00
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.
This commit is contained in:
4
CHANGES
4
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:
|
||||
|
||||
|
@@ -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, \
|
||||
|
@@ -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 */
|
||||
|
@@ -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},
|
||||
|
8
func.c
8
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,
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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:
|
||||
|
@@ -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
|
||||
|
@@ -33,7 +33,7 @@ EXAMPLE
|
||||
RAND state
|
||||
|
||||
; print srandom(seed())
|
||||
RAND state
|
||||
RANDOM state
|
||||
|
||||
LIMITS
|
||||
none
|
||||
|
@@ -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 */
|
||||
|
2
symbol.c
2
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";
|
||||
|
4
value.h
4
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 */
|
||||
|
2
zrand.c
2
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
|
||||
|
Reference in New Issue
Block a user