 
 : uniform-random-float ( min max -- n )
     random-generator get (uniform-random-float) ; inline
+
+M: float random [ f ] [ 0.0 swap uniform-random-float ] if-zero ;
 
 : random-unit ( -- n )
     0.0 1.0 uniform-random-float ; inline


M: object random-bytes* ( n tuple -- byte-array )
    [ [ <byte-vector> ] keep 4 /mod ] dip
    [ pick '[ _ random-32* int <ref> _ push-all ] times ]
    [
        over zero?
        [ 2drop ] [ random-32* int <ref> swap head append! ] if
    ] bi-curry bi* B{ } like ;

HINTS: M\ object random-bytes* { fixnum object } ;

<PRIVATE

: (uniform-random-float) ( min max obj -- n )
    [ 4 4 ] dip [ random-bytes* c:uint deref >float ] curry bi@
    2.0 32 ^ * +
    [ over - 2.0 -64 ^ * ] dip
    * + ; inline
