Subject: Re: pkg/34695
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: Mike M. Volokhov <mishka@NetBSD.org>
List: pkgsrc-bugs
Date: 10/06/2006 05:40:03
The following reply was made to PR pkg/34695; it has been noted by GNATS.
From: "Mike M. Volokhov" <mishka@NetBSD.org>
To: gnats-bugs@NetBSD.org
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.