Paste: make random strings

Author: blei
Mode: factor
Date: Fri, 26 Feb 2010 10:24:54
Plain Text |
: reader-loop ( -- )
    read1 [
        {
            { CHAR: \ [ read1 write1 ] }
            { CHAR: d [ 10 random CHAR: 0 write1 ] }
        } case reader-loop
    ] when* ;

: convert ( str -- str' )
    [ [ reader-loop ] with-string-writer ] with-string-reader ;

Annotation: blub

Author: blei
Mode: factor
Date: Fri, 26 Feb 2010 10:33:39
Plain Text |
: reader-loop ( -- )
    read1 [
        dup CHAR: \ = [
            drop read1
            { { CHAR: d [ CHAR: 0 10 random + write1 ] } } case
        ] [ write1 ] if
        reader-loop
    ] when* ;

: convert ( str -- str' )
    [ [ reader-loop ] with-string-writer ] with-string-reader ;

New Annotation

Summary:
Author:
Mode:
Body: