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