clear; clc;

format long;

% for old version of MATLAB
% s = RandStream.create('mt19937ar', 'seed', 5489);
% RandStream.setDefaultStream(s);

% for newer version of MATLAB
% rng('shuffle');
tic
N = 1e5;
x = rand(1, N);
y = rand(1, N);
pi_estimator = sum(x .^ 2 + y .^ 2 < 1) * 4 / N
toc