Sophie

Sophie

distrib > Mandriva > 2009.0 > i586 > by-pkgid > f4246b06d84022f6db6a5e7c4fa38c0b > files > 3

expect-5.43.0-14mdv2009.0.src.rpm

--- expect5.32/example/mkpasswd.random	Mon Jul 23 10:42:04 2001
+++ expect5.32/example/mkpasswd	Mon Jul 23 11:50:56 2001
@@ -92,7 +92,14 @@
 }
 
 proc rand {m} {
-    expr {int($m*rand())}
+    set device /dev/urandom		;# /dev/random can block
+    set fileId [open $device r]
+    binary scan [read $fileId 4] i1 number
+    set clipped [expr $number % $m]
+#    puts "number is $number"
+#    puts "clipped is $clipped"
+    close $fileId
+    return $clipped
 }
 
 # choose left or right starting hand