From 82ef9aa3189c343593a67c3e6086a2c036edc684 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Daniel=20Kochma=C5=84ski?= Date: Mon, 21 Sep 2015 18:08:50 +0200 Subject: [PATCH] random-state: allow initialization from the array MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Array used for initialization is an array of the final values of internal vector used to generate next randoms which should be a product of initialization from a random seed. This ability is required by CLHS to be able to read back the printed random state. To print readable representation of random state *print-readably* should be bound to T. Signed-off-by: Daniel Kochmański --- src/c/num_rand.d | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/c/num_rand.d b/src/c/num_rand.d index cc48ca6..588080f 100644 --- a/src/c/num_rand.d +++ b/src/c/num_rand.d @@ -212,6 +212,9 @@ ecl_make_random_state(cl_object rs) case t_random: z->random.value = cl_copy_seq(rs->random.value); break; + case t_vector: + z->random.value = cl_copy_seq(rs); + break; case t_fixnum: /* XXX: If we'll decide to use 64-bit algorithm for appropriate platforms then this will be replaced @@ -219,9 +222,6 @@ ecl_make_random_state(cl_object rs) z->random.value = init_genrand (ecl_to_uint32_t(rs)); break; - /* case t_vector: */ - /* z->random.value = init_by_array(rs, cl_length(rs)); */ - /* break; */ default: FEwrong_type_only_arg(@[make-random-state], rs, @[random-state]); -- 2.9.0