pkgsrc-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: pkg/34695
The following reply was made to PR pkg/34695; it has been noted by GNATS.
From: "Mike M. Volokhov" <mishka%NetBSD.org@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc:
Subject: Re: pkg/34695
Date: Thu, 5 Oct 2006 15:16:44 +0300
The single objection I've seen is that awk-based randomization logic
might not work with non NetBSD awks (for example, on Solaris). So, can
anybody confirm that the following script is workable on non NetBSD
platform?
{
srand(systime());
n = split($0, words);
for (i = n; i > 0; i--) {
ir = int(rand() * i + 1);
t = words[i];
words[i] = words[ir];
words[ir] = t;
print words[i];
}
}
Usage:
echo "one two three four five six seven eight nine ten" | awk -f random.awk
--
Mishka.
Home |
Main Index |
Thread Index |
Old Index