shuffle.pl

来自「This a good VPN source」· PL 代码 · 共 30 行

PL
30
字号
#!/usr/bin/perl# Takes a file as standard input, and emits a random order # for the file. Argument says how many lines to actually emit.$howmany=shift;if($howmany < 1) {  $howmany=1;}@lines=();$count=1;while(<>) {  $lines[$count++]=$_;}# init random seed.srand(time|$$);while($howmany-- > 0) {  $which=int(rand($count))+1;  print $lines[$which];}

⌨️ 快捷键说明

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