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