<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'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 'BEGIN { srand(); print int(rand() * 255 + 1) }'<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's rand seems to be seeded by the current epoch seconds, but in this<br>
case that doesn't matter.</blockquote><div style><br></div><div style>Looks good to me. I'd even go as far as implementing your nanosecond approach as the seed for AWK's 'srand()'. 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>'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>}'</div></blockquote>
</blockquote>}<div><br></div><div style>Then we can just call 'random_int' 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"><<a href="mailto:mle+la@mega-nerd.com" target="_blank">mle+la@mega-nerd.com</a>></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>
> Erik,<br>
><br>
> I was thinking of doing this:<br>
> export MALLOC_PERTURB_=$(awk 'BEGIN { srand(); print int(rand() * 32767 %<br>
> 255 + 1) }')<br>
><br>
> Or would you prefer using 'date'?<br>
<br>
</div>Your's is probably better and this is probably an improvement:<br>
<br>
awk 'BEGIN { srand(); print int(rand() * 255 + 1) }'<br>
<br>
Awk's rand seems to be seeded by the current epoch seconds, but in this<br>
case that doesn'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>