Which I think srand actually uses 'date' as it's seed in this case...
On Tue, Mar 19, 2013 at 10:29 PM, Jaren Stangret <sirja...@gmail.com> 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'? > > > On Tue, Mar 19, 2013 at 10:22 PM, Erik de Castro Lopo < > mle...@mega-nerd.com> wrote: > >> Jesse Weinstein wrote: >> >> > The subject line mostly says it all, but for reference, having >> #!/bin/sh causes the following error: >> > >> > arithmetic expression: expecting primary: " % 255 + 1" >> >> Arithmetic support is actually not the issue, rather its that dash/sh >> doesn't support $RANDOM. The solution to this is to replace $RANDOM >> with $(date +%N) which is obviouslsy not all that random, but which >> is close enough to random for this usage. >> >> Since Jaren is in the process of making the scripts POSIX shell >> compliant, I think swicthing to bash is a bad idea :-). >> >> I was going to do the $RANDOM to $(date +%N) conversion after Jaren's >> POSIX patches were all applied. >> >> Cheers, >> 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