Added randomize test option to ./check

Merge of master-melb:xfs-cmds:24664a by kenmcd.

  Added comment about the randomize '-r' option.
This commit is contained in:
Andrew Jones
2005-12-02 05:03:41 +00:00
parent 7a8eec9ca8
commit 9fdbc7d1e3
3 changed files with 36 additions and 2 deletions
+23
View File
@@ -0,0 +1,23 @@
# 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
}
{
srand()
for (i = 0; i < NF; i++ ) array[i] = $(i+1)
randomize(array, NF)
for (i = 0; i < NF; i++) printf("%s ", array[i])
}