Hi,
I am trying to create a specific RNG.
using values: un =064265094
cn =656992
tn =1064265094
my RNg will be: I(n+1)=[cn*I(n) + un*I(n1)]*(tn)
we can choose I(1) and I(2) as any seven digit number.
This is my algorithm so far.
% Undergraduate Number: Un = 064265094
% Candidate Number : Cn = 656992
% Card Number : Tn = 1064265094
% RNG i will be using is: I(n+1) = [CnI(n) + UnI(n1)](Tn)
% Initial Conditions i will choose are: I(1) = 7836998
% I(2) = 2431625
% Question A
% Write a program which computes the sequence J = {Rn}, Where Rn=I(n)/Tn
N = input('Enter Number of Rn Required: ');
I = ones(N,1); %Defines basis for I's as a matrix.
I(1) = 7836998;
I(2) = 2345678;
Cn = 656992;
Un = 64265094;
Tn = 1064265094;
% The RNG
for n = 2:N1
I(n+1) = ( ( Cn * I(n) ) + ( Un * I(n1) ) ) * (Tn);
end
% Compute Sequence of J = {Rn}
R = ones(N,1); %Defines basis for R's as a matrix.
for n = 1:N
R(n) = I(n)/Tn;
end
The problem i face is, from I(3) onward the values are far greater then 1, which is not what i want.
Can you help me please.
Cheers
Sid
