summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2014-03-14 00:26:37 -0700
committerKaz Kylheku <kaz@kylheku.com>2014-03-14 00:26:37 -0700
commit62ec2d2ec9d427866c9dea6fc507ea1c7976fb0f (patch)
tree1a964b4a1c99a8d1c170655c2e9fb7bbc9b51e98 /eval.c
parent9753507cc7c47f080606ba86b280a7d6a2b212be (diff)
downloadtxr-62ec2d2ec9d427866c9dea6fc507ea1c7976fb0f.tar.gz
txr-62ec2d2ec9d427866c9dea6fc507ea1c7976fb0f.tar.bz2
txr-62ec2d2ec9d427866c9dea6fc507ea1c7976fb0f.zip
* eval.c (eval_init): Make seed argument optional in make-random-state.
* rand.c (make_random_state): Do argument defaulting on seed. Also, mix getpid() into the seed. (random_fixnum): Bugfix: do proper defaulting on optional agument, rather than relying on nil. (random): Fix 2014-02-05 regression. This was totally broken, ignoring the random state passed in and using the global random state. This function must only use the state passed in; there is no defaulting to the global random state. * txr.1: Documenting that seed is optional in make-random-state. Describing what guarantees can be expected with regard to calls made close together temporally.
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/eval.c b/eval.c
index 8cf1f75c..a0f73610 100644
--- a/eval.c
+++ b/eval.c
@@ -3510,7 +3510,7 @@ void eval_init(void)
reg_fun(intern(lit("functionp"), user_package), func_n1(functionp));
reg_fun(intern(lit("interp-fun-p"), user_package), func_n1(interp_fun_p));
- reg_fun(intern(lit("make-random-state"), user_package), func_n1(make_random_state));
+ reg_fun(intern(lit("make-random-state"), user_package), func_n1o(make_random_state, 0));
reg_fun(intern(lit("random-state-p"), user_package), func_n1(random_state_p));
reg_fun(intern(lit("random-fixnum"), user_package), func_n1o(random_fixnum, 1));
reg_fun(intern(lit("random"), user_package), func_n2(random));