View Assignment101.java
// Estimate the value of Pi using Monte-Carlo Method, using sequential program | |
package assignments; | |
public class Assignment101 { | |
public static void main(String[] args) { | |
int nThrows = 100000; | |
long startTime = System.currentTimeMillis(); | |
double x = 0, y = 0; | |
int nSuccess = 0; | |
for (int i = 1; i <= nThrows; i++) { | |
x = Math.random(); |