I just tested the dice script myself, I do not see it impacting the entropy_avail at all:
cat /proc/sys/kernel/random/entropy_avail
4096
I ran the script 4-5 times and put in debug statements so I could see what the script is doing:
<rosc> .dice
[theentity(dcc)] [13:36] using file /dev/random
[theentity(dcc)] [13:36] rand 1516153535
[theentity(dcc)] [13:36] using file /dev/random
[theentity(dcc)] [13:36] rand 816658326
<TheEntity> rosc, 2d6: 2, 4 [Total: 6 (Avg), Avg: 3.00]
<rosc> .dice
[theentity(dcc)] [13:36] using file /dev/random
[theentity(dcc)] [13:36] rand 1692811833
[theentity(dcc)] [13:36] using file /dev/random
[theentity(dcc)] [13:36] rand -22754210
<TheEntity> rosc, 2d6: 2, 1 [Total: 3 (Low), Avg: 1.50]
cat /proc/sys/kernel/random/entropy_avail
4096
Then I made this change to the script:
Code: Select all
#antiwordwrapline###################################################################################################################
foreach f {/dev/random} {
if {[file exists $f]} { set file $f }
}
if {![info exists file]} {
error "Could not find a suitable random file"
} elseif {[catch {open $file r} fileid]} {
error "Could not open random file '$file'"
} elseif {![catch {fconfigure $fileid -buffersize 10} error] && ![binary scan [read $fileid 4] i rand]} {
close $fileid ; error "Random file '$file' gave weird input"
} else {
putcmdlog "[fconfigure $fileid]"
putcmdlog "using file $fileid"
putcmdlog "rand $rand"
close $fileid
return [expr {($rand & $maxint - 1) / double($maxint)}]
}
And this is what my log shows:
<rosc> .dice
[theentity(dcc)] [14:00] -blocking 1 -buffering full -buffersize 10 -encoding iso8859-1 -eofchar {} -translation auto
[theentity(dcc)] [14:00] using file file20
[theentity(dcc)] [14:00] rand 1592478028
[theentity(dcc)] [14:00] -blocking 1 -buffering full -buffersize 10 -encoding iso8859-1 -eofchar {} -translation auto
[theentity(dcc)] [14:00] using file file20
[theentity(dcc)] [14:00] rand -320820591
<TheEntity> rosc, 2d6: 2, 1 [Total: 3 (Low), Avg: 1.50]
I also tried it with -buffersize 15, and saw the appropriate change in the log:
[theentity(dcc)] [13:59] -blocking 1 -buffering full -buffersize 15 -encoding iso8859-1 -eofchar {} -translation auto
In all the tests I did, none of them impacted entropy_avail:
cat /proc/sys/kernel/random/entropy_avail
4096
Just in case it's relevent, my kernel version is:
uname -a
Linux xanadu 2.4.32 #1 SMP Sun Dec 11 20:45:49 EST 2005 i686 unknown
One last note, when I was testing the various random number generators, the results from the "eggdrop" option were somewhat better than the other options, at least IMO
edit:
I should also note that changing the buffer size did not affect the number of bits returned (it was 10, regardless of buffersize being set to 15) so I'm assuming the script already does limit the number of bits it grabbed, eg,
[binary scan [read $fileid 4] i rand]
read channelId numChars
and
binary scan i
i
The data is interpreted as count 32-bit signed integers represented in little-endian byte order. The integers are stored in the corresponding variable as a list. If count is *, then all of the remaining bytes in [50]string will be scanned. If count is omitted, then one 32-bit integer will be scanned. For example,
binary scan \x05\x00\x00\x00\x07\x00\x00\x00\xf0\xff\xff\xff i2i* var1 var2
will return 2 with 5 7 stored in var1 and -16 stored in var2.