Blame SOURCES/expect-5.32.2-random.patch

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