<div dir="ltr"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Your&#39;s is probably better and this is probably an improvement:<br>
</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"> </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
    awk &#39;BEGIN { srand(); print int(rand() * 255 + 1) }&#39;<br></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
 </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Awk&#39;s rand seems to be seeded by the current epoch seconds, but in this<br>
case that doesn&#39;t matter.</blockquote><div style><br></div><div style>Looks good to me.  I&#39;d even go as far as implementing your nanosecond approach as the seed for AWK&#39;s &#39;srand()&#39;.  Maybe set up a tiny function to use whenever we want a random integer:</div>
<div style><br></div><div style>random_int () {</div><div style><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div style>awk \</div></blockquote></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">
<div style><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div style>-v nanosecond_seed=$(date +%N) \</div></blockquote></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">
<div style><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div style>&#39;BEGIN {</div></blockquote></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">
<div style><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div style>srand( nanosecond_seed )</div></blockquote></div></blockquote></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">
<blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div style><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div style>print int ( rand() * 255 + 1 )</div></blockquote>}&#39;</div></blockquote>
</blockquote>}<div><br></div><div style>Then we can just call &#39;random_int&#39; in place of $RANDOM...</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Mar 20, 2013 at 1:24 AM, Erik de Castro Lopo <span dir="ltr">&lt;<a href="mailto:mle+la@mega-nerd.com" target="_blank">mle+la@mega-nerd.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">Jaren Stangret wrote:<br>
<br>
&gt; Erik,<br>
&gt;<br>
&gt; I was thinking of doing this:<br>
&gt; export MALLOC_PERTURB_=$(awk &#39;BEGIN { srand(); print int(rand() * 32767 %<br>
&gt; 255 + 1) }&#39;)<br>
&gt;<br>
&gt; Or would you prefer using &#39;date&#39;?<br>
<br>
</div>Your&#39;s is probably better and this is probably an improvement:<br>
<br>
    awk &#39;BEGIN { srand(); print int(rand() * 255 + 1) }&#39;<br>
<br>
Awk&#39;s rand seems to be seeded by the current epoch seconds, but in this<br>
case that doesn&#39;t matter.<br>
<div class="HOEnZb"><div class="h5"><br>
Erik<br>
--<br>
----------------------------------------------------------------------<br>
Erik de Castro Lopo<br>
<a href="http://www.mega-nerd.com/" target="_blank">http://www.mega-nerd.com/</a><br>
_______________________________________________<br>
flac-dev mailing list<br>
<a href="mailto:flac-dev@xiph.org">flac-dev@xiph.org</a><br>
<a href="http://lists.xiph.org/mailman/listinfo/flac-dev" target="_blank">http://lists.xiph.org/mailman/listinfo/flac-dev</a><br>
</div></div></blockquote></div><br></div>