 
 : 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

! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors alien.c-types alien.data arrays assocs
byte-arrays byte-vectors combinators combinators.short-circuit
fry hashtables hashtables.private hints io.backend io.binary
kernel locals math math.bitwise math.constants math.functions
math.order math.ranges namespaces sequences sequences.private
sets summary system typed vocabs ;
IN: random

SYMBOL: system-random-generator

<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
