Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
function genrand(n) {
return int(1 + rand() * n)
}
BEGIN {
i=1
while ((getline < ARGV[1]) > 0) {
filearray[i] = $0
++i
}
close(ARGV[1])
srand()
for (x=1 ; x <= 10 ; x++) {
start = genrand(i) ; end = genrand(i)
#printf "Printing partition %d of 10\n", x
if (start < end) {
while (end > start) {
print filearray[end]
end--
}
} else if (start > end) {
while (start > end) {
print filearray[end]
start--
}
} else {
print filearray[start]
}
#printf "Finished with iteration %d\n\n\n", x
#system("sleep 1")
}
}
function genrand(n) {
return int(1 + rand() * n)
}
function numelements(arr, cnt) {
pp=0
for (pp in arr) {
if (arr[pp]) {
cnt++
}
}
return cnt
}
BEGIN {
x = 1; while ((getline var[x] < ARGV[1]) > 0) {
x++
}
close(ARGV[1])
num = int(x / 10); print num, "Is element size"
srand()
gg=0
a=0
f=0
do {
gg++
for (i=1 ; i <= num && (f = numelements(var)) > 0 ; i++) {
ind = genrand(x)
#printf "Printing element %d and numelements = %d\n", ind, f
if (var[ind] && !ind in mlist) {
mlist[a++] = ind
printf "%s : %d\n", var[ind],ind
delete var[ind]
}
}
} while (gg <= 10)
}