% Unit 2 (MATLAB Course @ UAM)
% (c) Alexander Knebe
clear all
close all
clc


% generate 10^6 random numbers on the intervall [1,100]
x = rand(1,1e6)*99+1;

% find the positions of those numbers that lie on the intervall [20,30]
i = find(x>=20 & x <=30);

% the fraction is now simply the ratio between the lengths of i() and x()
frac = length(i)/length(x)