19 lines
505 B
Diff
19 lines
505 B
Diff
|
--- 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
|