Posted to tcl by kostix at Mon Jun 02 22:36:26 GMT 2008view pretty

proc rand num {
    set fd [open "| openssl rand $num"]
    fconfigure $fd -translation binary
    set data [read $fd]
    close $fd
    binary scan $data H* hex
    if {[string length $hex] != 2 * $num} {
        error "HEX: $hex, data len: [string length $data]"
    }
}

while 1 { rand 4 }