> > Your's is probably better and this is probably an improvement: >
awk 'BEGIN { srand(); print int(rand() * 255 + 1) }' > Awk's rand seems to be seeded by the current epoch seconds, but in this > case that doesn't matter. 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: random_int () { awk \ -v nanosecond_seed=$(date +%N) \ 'BEGIN { srand( nanosecond_seed ) print int ( rand() * 255 + 1 ) }' } Then we can just call 'random_int' in place of $RANDOM... On Wed, Mar 20, 2013 at 1:24 AM, Erik de Castro Lopo <mle...@mega-nerd.com>wrote: > Jaren Stangret wrote: > > > Erik, > > > > I was thinking of doing this: > > export MALLOC_PERTURB_=$(awk 'BEGIN { srand(); print int(rand() * 32767 % > > 255 + 1) }') > > > > Or would you prefer using 'date'? > > Your's is probably better and this is probably an improvement: > > awk 'BEGIN { srand(); print int(rand() * 255 + 1) }' > > Awk's rand seems to be seeded by the current epoch seconds, but in this > case that doesn't matter. > > Erik > -- > ---------------------------------------------------------------------- > Erik de Castro Lopo > http://www.mega-nerd.com/ > _______________________________________________ > flac-dev mailing list > flac-dev@xiph.org > http://lists.xiph.org/mailman/listinfo/flac-dev >
_______________________________________________ flac-dev mailing list flac-dev@xiph.org http://lists.xiph.org/mailman/listinfo/flac-dev