RandomPermutation.cpp File Reference

Prints a random permutation of integers. More...

#include "RandomLib/Random.hpp"
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>

Go to the source code of this file.

Defines

#define RANDOMPERMUTATION_CPP   "$Id: RandomPermutation.cpp 6490 2008-11-10 21:53:54Z ckarney $";

Functions

 RCSID_DECL (RANDOMPERMUTATION_CPP)
void usage (const std::string name, int retval)
int main (int argc, char *argv[])

Detailed Description

Prints a random permutation of integers.

Usage: RandomPermutation [-o] [-d] [-x] [-s seed] [-v] [-h] [num]

Print a random permutation of numbers from 0 thru num-1 on standard output. num is supplied on the command line as a decimal number (default is 100). Optional arguments -o, -d, and -x selection octal, decimal, and hexadecimal output base (default decimal). -s seed sets the seed. -v prints seed on standard error. -h prints this help.

seed is typically a list of comma-separated numbers, e.g., -s ""; -s 1234; -s 1,2,3,4; etc. You can repeat a permutation by using the form of the seed printed to standard error with -v as the argument to -s, e.g., -s "[671916,1201036551,9299,562196172,2008]". If the seed is omitted, a "unique" seed is used.

This is used by the "shuffle" script to shuffle the lines of a file.

Written by Charles Karney <charles@karney.com> and licensed under the GPL. For more information, see http://charles.karney.info/random/

Definition in file RandomPermutation.cpp.


Define Documentation

#define RANDOMPERMUTATION_CPP   "$Id: RandomPermutation.cpp 6490 2008-11-10 21:53:54Z ckarney $";

Definition at line 32 of file RandomPermutation.cpp.


Function Documentation

RCSID_DECL ( RANDOMPERMUTATION_CPP   ) 
void usage ( const std::string  name,
int  retval 
)

Definition at line 35 of file RandomPermutation.cpp.

Referenced by main().

int main ( int  argc,
char *  argv[] 
)

Definition at line 49 of file RandomPermutation.cpp.

References usage().


Generated on Thu Dec 31 15:24:29 2009 by  doxygen 1.6.1