clear; clc; close all;

s0 = 250;
r = 0.05;
v = 0.2;
T = 1;

N = 252;
dt = T / N;

figure;
set(gcf, 'position', [100, 100, 1000, 400]);
subplot(1, 2, 1); hold on; grid on;
prices = zeros(1, 100);
for j = 1 : 100
    S = zeros(1, N + 1);
    S(1) = s0;
    for i = 2 : length(S)
        S(i) = S(i - 1) * (1 + r * dt + v * sqrt(dt) * randn(1));
    end
    plot(0 : N, S, '.-');
    prices(j) = S(end);
end
subplot(1, 2, 2); histogram(prices, 20);
% histogram(prices, 'binmethod', 'integer');

