From 927414c6c5990b2861e4b8c868e05b4091712423 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Wed, 27 Feb 2013 15:26:56 -0800 Subject: [PATCH] random: minor speedup (random-bits). --- basis/random/random.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basis/random/random.factor b/basis/random/random.factor index bf0c8c019f..477109ec6b 100644 --- a/basis/random/random.factor +++ b/basis/random/random.factor @@ -53,7 +53,7 @@ TYPED: random-bytes ( n: fixnum -- byte-array: byte-array ) :: (random-bits) ( n bits obj -- n' ) obj random-32* 32 bits 32 - [ dup 0 > ] [ [ 32 shift obj random-32* + ] [ 32 + ] [ 32 - ] tri* - ] while drop [ n * ] [ 2^ /i ] bi* ; inline + ] while drop [ n * ] [ neg shift ] bi* ; inline : (random-integer) ( n obj -- n' ) [ dup #bits ] dip (random-bits) ;