Strip extra spaces from code.
[voro++.git] / branches / dynamic / scripts / random.pl
blob0cb65450849da26c3790212372f755157078ebbb
1 #!/usr/bin/perl
2 # This script can be used to generate random lists of particles in the unit
3 # box 0<x<1, 0<y<1, 0<z<1, that can be used as test input to voro++. The -r
4 # switch adds extra radial information for use with the Voronoi radical
5 # tessellation.
6 use Getopt::Std;
7 getopts("hr:");
9 if ($opt_h) {
10 print "Usage: random.pl [switches] <number of particles> <filename>\n";
11 print "Switches:\n";
12 print "-h Print this information\n";
13 print "-r <max radius> Add extra radial column\n";
14 exit 0;
17 @ARGV==2 or die "Exactly two command line arguments required\n";
18 open A,">@ARGV[1]" or die "Can't open output file";
20 foreach (1..@ARGV[0]) {
21 printf A "$_ %f %f %f", rand(), rand(), rand();
22 printf A " %f",$opt_r*rand() if $opt_r;
23 printf A "\n";