public class ComputePi extends MonteCarloIntegration
| Constructor and Description |
|---|
ComputePi(RandomSource source) |
| Modifier and Type | Method and Description |
|---|---|
double |
compute(long numPoints) |
protected boolean |
isInside(double... rand)
Indicates whether the given points is inside the region whose
integral is computed.
|
static void |
main(String[] args)
Program entry point.
|
integratepublic ComputePi(RandomSource source)
source - RNG algorithm.public static void main(String[] args)
args - Arguments.
The order is as follows:
Random source identifier.
public double compute(long numPoints)
numPoints - Number of random points to generate.protected boolean isInside(double... rand)
isInside in class MonteCarloIntegrationrand - Point whose coordinates are random numbers uniformly
distributed in the unit interval.true if the point is inside.Copyright © 2016 The Apache Software Foundation. All rights reserved.