function realization=generate_realization(apriori,index,H,C,horizont)
eta=apriori.eta0;
switch(apriori.Hc)
    case(0)
        eta=0;
    case(1)
        eta=eta*rand;
    case(2)
        %eta=eta*abs((1+randn)/5^(index-1));
        %eta=eta/10^(-floor(-H(index)/H(end)*size(H,2))-1);
        eta=eta/10^H(index);
    case(3)
        %eta=eta/2*abs((1+randn)/5^(index-1));
        eta=eta/10^H(index)*rand;
end

realization=0;
beta=H(index);
for o=1:horizont
    best_control=-(eta*beta/(1+beta^2)+interpol(beta,H,C));
    %best_control=-(eta*beta/(1+beta^2)+C(index)*abs(rand));
    s=randn;
    pom=sqrt(1+best_control^2);
    eta=abs(eta+beta*best_control+pom*s);
    beta=abs(pom*beta+best_control*s);
    realization=realization+eta^2;
end
end