#include #include #include #include using namespace std; class line : public string { }; istream& operator>>(istream& i, line& s) { s.clear(); while (true) { char c; i.get(c); if (i.eof()) break; s.push_back(c); if (c == '\n') break; } return i; } template struct randgen { typedef typename Container::difference_type argument_type; typedef typename Container::difference_type result_type; result_type operator()(argument_type n) { return lrand48() % n; } }; randgen > randgen1; int main(int argc, char* argv[]) { vector lines; if (argc == 2) srand48(atoi(argv[1])); else { srand48(7); cerr << "******Rerun with one command line argument, an integer, " << "to get a different scrambling of the output." << endl; } typedef istream_iterator line_input; copy(line_input(cin), line_input(), back_inserter(lines)); random_shuffle(lines.begin(), lines.end(), randgen1); typedef ostream_iterator line_output; copy(lines.begin(), lines.end(), line_output(cout, "")); return 0; }