<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/12452" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2006-09-25T02:57:03-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/12452</id>

		<entry>
		<author><name><![CDATA[crappuccino]]></name></author>
		<updated>2006-09-25T02:57:03-04:00</updated>

		<published>2006-09-25T02:57:03-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=66662#p66662</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=66662#p66662"/>
		<title type="html"><![CDATA[regarding the dice.tcl script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=66662#p66662"><![CDATA[
hum, thanks for your effort, i'm going to sit awhile trying to figure out what that means <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8217">crappuccino</a> — Mon Sep 25, 2006 2:57 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[rosc2112]]></name></author>
		<updated>2006-09-24T14:17:49-04:00</updated>

		<published>2006-09-24T14:17:49-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=66644#p66644</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=66644#p66644"/>
		<title type="html"><![CDATA[regarding the dice.tcl script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=66644#p66644"><![CDATA[
I just tested the dice script myself, I do not see it impacting the entropy_avail at all:<br><br>cat /proc/sys/kernel/random/entropy_avail <br>4096<br><br>I ran the script 4-5 times and put in debug statements so I could see what the script is doing:<br><br>&lt;rosc&gt; .dice<br>[theentity(dcc)] [13:36] using file /dev/random<br>[theentity(dcc)] [13:36] rand 1516153535<br>[theentity(dcc)] [13:36] using file /dev/random<br>[theentity(dcc)] [13:36] rand 816658326<br>&lt;TheEntity&gt; rosc, 2d6: 2, 4 [Total: 6 (Avg), Avg: 3.00]<br>&lt;rosc&gt; .dice<br>[theentity(dcc)] [13:36] using file /dev/random<br>[theentity(dcc)] [13:36] rand 1692811833<br>[theentity(dcc)] [13:36] using file /dev/random<br>[theentity(dcc)] [13:36] rand -22754210<br>&lt;TheEntity&gt; rosc, 2d6: 2, 1 [Total: 3 (Low), Avg: 1.50]<br><br>cat /proc/sys/kernel/random/entropy_avail <br>4096<br><br>Then I made this change to the script:<div class="codebox"><p>Code: </p><pre><code>#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] &amp;&amp; ![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 &amp; $maxint - 1) / double($maxint)}]                   }</code></pre></div>And this is what my log shows:<br><br>&lt;rosc&gt; .dice<br>[theentity(dcc)] [14:00] -blocking 1 -buffering full -buffersize 10 -encoding iso8859-1 -eofchar {} -translation auto<br>[theentity(dcc)] [14:00] using file file20<br>[theentity(dcc)] [14:00] rand 1592478028<br>[theentity(dcc)] [14:00] -blocking 1 -buffering full -buffersize 10 -encoding iso8859-1 -eofchar {} -translation auto<br>[theentity(dcc)] [14:00] using file file20<br>[theentity(dcc)] [14:00] rand -320820591<br>&lt;TheEntity&gt; rosc, 2d6: 2, 1 [Total: 3 (Low), Avg: 1.50]<br><br><br>I also tried it with -buffersize 15, and saw the appropriate change in the log:<br>[theentity(dcc)] [13:59] -blocking 1 -buffering full -buffersize 15 -encoding iso8859-1 -eofchar {} -translation auto<br><br>In all the tests I did, none of them impacted entropy_avail:<br> cat /proc/sys/kernel/random/entropy_avail <br>4096<br><br>Just in case it's relevent, my kernel version is:<br> uname -a<br>Linux xanadu 2.4.32 #1 SMP Sun Dec 11 20:45:49 EST 2005 i686 unknown<br><br>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 <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>edit:<br>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, <br><br>[binary scan [read $fileid 4] i rand]<br><br>read channelId numChars<br><br>and<br><br>binary scan i<br><br>   i<br>          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,<br>         <br>binary scan \x05\x00\x00\x00\x07\x00\x00\x00\xf0\xff\xff\xff i2i* var1 var2<br>          will return 2 with 5 7 stored in var1 and -16 stored in var2.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7395">rosc2112</a> — Sun Sep 24, 2006 2:17 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[crappuccino]]></name></author>
		<updated>2006-09-23T23:53:06-04:00</updated>

		<published>2006-09-23T23:53:06-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=66629#p66629</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=66629#p66629"/>
		<title type="html"><![CDATA[regarding the dice.tcl script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=66629#p66629"><![CDATA[
uhm, as stated before, i don't know jack about tcl or coding in general, so even if i somehow figured out the right fconfigure command, i wouldn't even know where to put it <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8217">crappuccino</a> — Sat Sep 23, 2006 11:53 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[rosc2112]]></name></author>
		<updated>2006-09-22T21:08:23-04:00</updated>

		<published>2006-09-22T21:08:23-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=66583#p66583</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=66583#p66583"/>
		<title type="html"><![CDATA[regarding the dice.tcl script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=66583#p66583"><![CDATA[
I've been looking at the dice script, and I'm thinking that you might need to use fconfigure to set the encoding type to binary, and also set the buffersize to it's smallest limit (which is 10 bytes.) Check the manpages for tcl's 'binary' and 'fconfigure' commands.  I haven't tried it, but I'm certainly curious at this point &lt;grin&gt;<br><br>Let us know if that helps.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7395">rosc2112</a> — Fri Sep 22, 2006 9:08 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[crappuccino]]></name></author>
		<updated>2006-09-22T17:22:08-04:00</updated>

		<published>2006-09-22T17:22:08-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=66578#p66578</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=66578#p66578"/>
		<title type="html"><![CDATA[regarding the dice.tcl script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=66578#p66578"><![CDATA[
sklave ~ # cat /proc/sys/kernel/random/entropy_avail<br>202<br>sklave ~ # dd if=/dev/random of=./bla.txt bs=8 count=1<br>1+0 records in<br>1+0 records out<br>8 bytes (8 B) copied, 6.3e-05 seconds, 127 kB/s<br>sklave ~ # ls -l<br>total 4<br>-rw-r--r-- 1 root root 8 Sep 22 23:18 bla.txt<br>sklave ~ # cat /proc/sys/kernel/random/entropy_avail<br>168<br><br>to me it looks like there is <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"><br>but i mistook the entropy_avail number for bytes instead of bits <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_confused.gif" width="15" height="15" alt=":?" title="Confused"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8217">crappuccino</a> — Fri Sep 22, 2006 5:22 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[rosc2112]]></name></author>
		<updated>2006-09-22T07:22:16-04:00</updated>

		<published>2006-09-22T07:22:16-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=66553#p66553</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=66553#p66553"/>
		<title type="html"><![CDATA[regarding the dice.tcl script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=66553#p66553"><![CDATA[
<blockquote class="uncited"><div>RANDOM(4)           Linux Programmer's Manual           RANDOM(4)<br><br>NAME<br>       random, urandom - kernel random number source devices<br><br>DESCRIPTION<br>       The  character  special  files  /dev/random  and /dev/urandom (present since Linux 1.3.30) provide an interface to the kernel's random number generator.  File /dev/random has major device  number  1  and minor device number 8.  File /dev/urandom has major device number 1 and minor device number 9.<br><br>       The random number generator gathers environmental noise from device drivers and other sources into an entropy pool.  The generator also keeps an estimate of the number of bit of the noise in the  entropy       pool.  From this entropy pool random numbers are created.<br><br>       When  read,  the /dev/random device will only return random bytes within the estimated number of bits of noise in the entropy pool.  /dev/random should be suitable for uses that need  very  high  quality randomness  such  as  one-time  pad  or  key  generation.   When  the entropy pool is empty, reads to  /dev/random will block until additional environmental noise is gathered.<br><br>       When read, /dev/urandom device will return as many bytes as are requested. </div></blockquote>Doesn't look like there is a way to limit the number of bites returned by /dev/random<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7395">rosc2112</a> — Fri Sep 22, 2006 7:22 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[crappuccino]]></name></author>
		<updated>2006-09-22T03:53:09-04:00</updated>

		<published>2006-09-22T03:53:09-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=66545#p66545</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=66545#p66545"/>
		<title type="html"><![CDATA[regarding the dice.tcl script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=66545#p66545"><![CDATA[
his page hasn't been responding for 2 days, that's why i came here in the first place <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_confused.gif" width="15" height="15" alt=":?" title="Confused"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8217">crappuccino</a> — Fri Sep 22, 2006 3:53 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Alchera]]></name></author>
		<updated>2006-09-22T03:28:23-04:00</updated>

		<published>2006-09-22T03:28:23-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=66544#p66544</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=66544#p66544"/>
		<title type="html"><![CDATA[regarding the dice.tcl script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=66544#p66544"><![CDATA[
<blockquote class="uncited"><div>it's a dude called KuNgFo0, i thought he would be somehow related to this forum as he is mentioned at the main page <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"></div></blockquote>As far as I am aware KuNgFo0 has never been a member; I think there is a link to his website on the main egghelp.org page (which does not indicate affiliation with these forums).<br><br>His script/website will have contact details.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3646">Alchera</a> — Fri Sep 22, 2006 3:28 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[crappuccino]]></name></author>
		<updated>2006-09-22T02:40:05-04:00</updated>

		<published>2006-09-22T02:40:05-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=66541#p66541</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=66541#p66541"/>
		<title type="html"><![CDATA[regarding the dice.tcl script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=66541#p66541"><![CDATA[
it's a dude called KuNgFo0, i thought he would be somehow related to this forum as he is mentioned at the main page <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8217">crappuccino</a> — Fri Sep 22, 2006 2:40 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Alchera]]></name></author>
		<updated>2006-09-22T01:34:33-04:00</updated>

		<published>2006-09-22T01:34:33-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=66540#p66540</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=66540#p66540"/>
		<title type="html"><![CDATA[regarding the dice.tcl script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=66540#p66540"><![CDATA[
Possibly contact the author?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3646">Alchera</a> — Fri Sep 22, 2006 1:34 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[crappuccino]]></name></author>
		<updated>2006-09-22T00:12:37-04:00</updated>

		<published>2006-09-22T00:12:37-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=66535#p66535</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=66535#p66535"/>
		<title type="html"><![CDATA[regarding the dice.tcl script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=66535#p66535"><![CDATA[
hi,<br>i'm having the problem that dice.tcl takes far too much entropy from /dev/random. it seems to always drain the complete pool, so subsequent rolls get delayed by ages. i just rolled a d20 and it used up 520 bytes of entropy when it only needs 5 bits. is there a way to change this? i have absolutely no clue about tcl scripting or a way to retrieve the proper number of bits from /dev/random.<br>oh and i don't like the idea of using urandom or another pseudogenerator <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"><br><br>thanks for your time<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8217">crappuccino</a> — Fri Sep 22, 2006 12:12 am</p><hr />
]]></content>
	</entry>
	</feed>
