blob: d979fb03af7faf3821d03f1387e2c55dc6c653fe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2005 Silicon Graphics, Inc. All Rights Reserved.
#
# randomize stdin.
function randomize(array, N) {
for(i = 0; i < N; i++) {
j = int(rand()*N)
if ( i != j) {
tmp = array[i]
array[i] = array[j]
array[j] = tmp
}
}
return
}
BEGIN {
srand(seed)
}
{
array[NR - 1] = $0
}
END {
randomize(array, NR)
for (i = 0; i < NR; i++) printf("%s ", array[i])
}
|