unsort.pl

来自「一个C语言写的快速贝叶斯垃圾邮件过滤工具」· PL 代码 · 共 19 行

PL
19
字号
#! /usr/bin/env perl# unsort.pl - print words of a short file in random order# processes from stdin to stdout# Copyright (C) 2004 by Matthias Andree# This file is under the GNU General Public License, v2my @a = <>;chomp @a;@a = split ' ', join(' ', @a);srand(time ^ ($$ + ($$ << 15)));while(scalar @a) {    my $pos = int rand scalar @a;    print $a[$pos], "\n";    @a = (@a[0..($pos-1)],@a[($pos+1)..$#a]);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?