home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
OL.LZH
/
PROGS.LZH
/
SHUFFILE.ICN
< prev
next >
Wrap
Text File
|
1991-07-13
|
2KB
|
61 lines
############################################################################
#
# Name: shuffile.icn
#
# Title: Shuffle lines in a file
#
# Author: Ralph E. Griswold
#
# Date: June 10, 1988
#
############################################################################
#
# This program writes a version of the input file with the lines
# shuffled. For example, the result of shuffling
#
# On the Future!-how it tells
# Of the rapture that impells
# To the swinging and the ringing
# Of the bells, bells, bells-
# Of the bells, bells, bells, bells,
# Bells, bells, bells-
# To the rhyming and the chiming of the bells!
#
# is
#
# To the rhyming and the chiming of the bells!
# To the swinging and the ringing
# Bells, bells, bells-
# Of the bells, bells, bells-
# On the Future!-how it tells
# Of the bells, bells, bells, bells,
# Of the rapture that impells
#
# Option: The option -s n sets the seed for random generation to n.
# The default seed is 0.
#
# Limitation:
#
# This program stores the input file in memory and
# shuffles pointers to the lines; there must be enough memory
# available to store the entire file.
#
############################################################################
#
# Links: options, shuffle
#
############################################################################
link options, shuffle
procedure main(args)
local opts, a
opts := options(args, "s+")
&random := \opts["s"]
a := []
every put(a,!&input)
every write(!shuffle(a))
end