This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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(); |