26470e
diff -up expect-5.44.1.15/example/mkpasswd.orig expect-5.44.1.15/example/mkpasswd
26470e
--- expect-5.44.1.15/example/mkpasswd.orig	2010-03-08 16:01:05.518378075 +0100
26470e
+++ expect-5.44.1.15/example/mkpasswd	2010-03-08 16:01:27.408388162 +0100
26470e
@@ -92,7 +92,14 @@ proc insert {pvar char} {
26470e
 }
26470e
 
26470e
 proc rand {m} {
26470e
-    expr {int($m*rand())}
26470e
+    set device /dev/urandom            ;# /dev/random can block
26470e
+    set fileId [open $device r]
26470e
+    binary scan [read $fileId 4] i1 number
26470e
+    set clipped [expr $number % $m]
26470e
+#    puts "number is $number"
26470e
+#    puts "clipped is $clipped"
26470e
+    close $fileId
26470e
+    return $clipped
26470e
 }
26470e
 
26470e
 # choose left or right starting hand