Introduction
Introduction Statistics Contact Development Disclaimer Help
Add useful idiotbox technology. - annna - Annna the nice friendly bot.
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6…
Log
Files
Refs
Tags
README
---
commit 1e01eb48430a06a8e2ec480a2e6d8d62e024bb95
parent 2818dd96ec191a68f1266734ff7107b9acb1bb71
Author: eidolon <?>
Date: Thu, 24 Oct 2024 13:10:07 -0400
Add useful idiotbox technology.
Signed-off-by: Annna Robert-Houdin <[email protected]>
Diffstat:
M idiotbox-roulette | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
---
diff --git a/idiotbox-roulette b/idiotbox-roulette
@@ -4,17 +4,9 @@
# Thanks!
spin() {
- awk -F "\t" '
- BEGIN { srand() }
- function randomidiot(n) {
- return int(rand() * n)
- }
- /^h/ && !/^hAtom/ { out[i++] = $1" "$2 }
- END {
- s = out[randomidiot(length(out))]
- sub(/URL:/, "url: ", s)
- print substr(s, 2)
- }'
+ awk 'BEGIN { FS = "\t"; srand() }
+ /^h/ && !/^hAtom/ { if (rand() < 1 / ++n) out = $0 }
+ END { sub(/URL:/, "url: ", out); print substr(out, 2) }'
}
[ -z "$1" ] && exit 1
You are viewing proxied material from bitreich.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.