Blame SOURCES/expect-5.32.2-random.patch

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