expect-fedora-5.32.2-random.patch 629 B

1234567891011121314151617181920
  1. diff -up expect-5.43/example/mkpasswd.random expect-5.43/example/mkpasswd
  2. --- expect-5.43/example/mkpasswd.random 2004-12-07 00:38:21.000000000 +0100
  3. +++ expect-5.43/example/mkpasswd 2008-09-25 12:27:19.000000000 +0200
  4. @@ -92,7 +92,14 @@ proc insert {pvar char} {
  5. }
  6. proc rand {m} {
  7. - expr {int($m*rand())}
  8. + set device /dev/urandom ;# /dev/random can block
  9. + set fileId [open $device r]
  10. + binary scan [read $fileId 4] i1 number
  11. + set clipped [expr $number % $m]
  12. +# puts "number is $number"
  13. +# puts "clipped is $clipped"
  14. + close $fileId
  15. + return $clipped
  16. }
  17. # choose left or right starting hand