edu.rit.smp.monte
Class PiSeq

java.lang.Object
  extended by edu.rit.smp.monte.PiSeq

public class PiSeq
extends Object

Class PiSeq is a sequential program that calculates an approximate value for π using a Monte Carlo technique. The program generates a number of random points in the unit square (0,0) to (1,1) and counts how many of them lie within a circle of radius 1 centered at the origin. The fraction of the points within the circle is approximately π/4.

Usage: java edu.rit.smp.monte.PiSeq seed N
seed = Random seed
N = Number of random points

The computation is performed sequentially in a single processor. The program measures the computation's running time. This establishes a benchmark for measuring the computation's running time on a parallel processor.


Method Summary
static void main(String[] args)
          Main program.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

main

public static void main(String[] args)
                 throws Exception
Main program.

Throws:
Exception


Copyright © 2005-2012 by Alan Kaminsky. All rights reserved. Send comments to ark­@­cs.rit.edu.