diff --git a/CHANGELOG b/CHANGELOG index 355d5d7e3..d0a80933f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -32,15 +32,15 @@ - make-random-state: fix problem with simple-vectors The correct initialization types for =make-random-state= are: -=(OR RANDOM-STATE (MEMBER T NIL))= +=(OR RANDOM-STATE FIXNUM (MEMBER T NIL))= Initializing a random state with an appropriate array (element type and -arity) or with a fixnum is now possible only with the #$ reader macro. +arity) is now possible only with the #$ reader macro. ** Enhancements - Removed 15000 lines of obsolete code Files not included in the buildsystem but lingering in the codebase or -options failing to build. All info is added in the new documentation in +options failing to build. All info is added in the new documentation in the section "Removed interfaces". - Improved man page and help output. diff --git a/src/c/num_rand.d b/src/c/num_rand.d index cefb267d2..44958b658 100644 --- a/src/c/num_rand.d +++ b/src/c/num_rand.d @@ -287,18 +287,25 @@ ecl_make_random_state(cl_object rs) if (rs == ECL_T) { z->random.value = init_random_state(); return z; - } - - if (Null(rs)) + } else if (Null(rs)) { rs = ecl_symbol_value(@'*random-state*'); - - if (ecl_t_of(rs) == t_random) { z->random.value = cl_copy_seq(rs->random.value); return z; } - FEwrong_type_only_arg(@[make-random-state], rs, - ecl_read_from_cstring(type)); + switch (ecl_t_of(rs)) { + case t_random: + z->random.value = cl_copy_seq(rs->random.value); + break; + case t_fixnum: + z->random.value = init_genrand(ecl_fixnum(rs)); + break; + default: + FEwrong_type_only_arg(@[make-random-state], rs, + ecl_read_from_cstring(type)); + } + + return z; } @(defun random (x &optional (rs ecl_symbol_value(@'*random-state*'))) diff --git a/src/c/read.d b/src/c/read.d index ad1e5e013..c5f5388f1 100644 --- a/src/c/read.d +++ b/src/c/read.d @@ -1399,10 +1399,6 @@ sharp_dollar_reader(cl_object in, cl_object c, cl_object d) break; } #endif - case t_fixnum: - rs = ecl_alloc_object(t_random); - rs->random.value = init_genrand(ecl_fixnum(c)); - break; default: rs = ecl_make_random_state(c); break;