Paste: ((random-integer))

Author: otoburb
Mode: factor
Date: Thu, 30 Aug 2012 01:59:09
Plain Text |
:: ((random-integer)) ( bits obj -- n required-bits )
    obj random-32* 32 bits 32 - [ dup 0 > ] [
        [ 32 shift obj random-32* + ] [ 32 + ] [ 32 - ] tri*
    ] while drop ;

Annotation: why can't i do this instead?

Author: otoburb
Mode: factor
Date: Thu, 30 Aug 2012 02:04:16
Plain Text |
: ((random-integer)) ( num-bits obj -- n )
    random-32* swap bits ;

New Annotation

Summary:
Author:
Mode:
Body: