From ccc69a5ef4883d2eac34a953cb561d19dfab73fe Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Thu, 1 Oct 2009 11:58:52 -0500 Subject: [PATCH] fix bug in random-bytes* when no random-32* exists --- basis/random/random-tests.factor | 3 +++ basis/random/random.factor | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/basis/random/random-tests.factor b/basis/random/random-tests.factor index da8d4a1844..96dc8cc783 100644 --- a/basis/random/random-tests.factor +++ b/basis/random/random-tests.factor @@ -30,3 +30,6 @@ IN: random.tests [ 3 ] [ { 1 2 3 4 } 3 sample prune length ] unit-test [ 99 ] [ 100 99 sample prune length ] unit-test + +[ ] +[ [ 100 random-bytes ] with-system-random drop ] unit-test diff --git a/basis/random/random.factor b/basis/random/random.factor index 1f2408556f..197c232404 100755 --- a/basis/random/random.factor +++ b/basis/random/random.factor @@ -22,7 +22,7 @@ M: object random-bytes* ( n tuple -- byte-array ) [ 2drop ] [ random-32* 4 >le swap head over push-all ] if ] bi-curry bi* ; -M: object random-32* ( tuple -- r ) 4 random-bytes* le> ; +M: object random-32* ( tuple -- r ) 4 swap random-bytes* le> ; ERROR: no-random-number-generator ;