function [t,I_t,Korr]=SIS_stochm(p)

param;

G=strogatz(p);

m=[0 1];    % different possible states (here it is for SIS) S=0, I=1.

t=linspace(0,T_max,T_max/dt+1);

I_t=zeros(size(t)); %Initial condition
SI_t=zeros(size(t)); 
Reps=5
for r=1:Reps
    
    current=m(1)*ones(1,N); %Set all nodes to 'S'
    
    % Kezdõvektor létrehozása
    
    ind_vector=1:N;
    
    for i=1:Kezdeti
        rand_ind=round((N-i)*rand);
        ind=ind_vector(rand_ind+1);
        current(ind)=m(2);
        ind_vector=setdiff(ind_vector,ind);
    end


    for s=1:length(t)
        
        count=0; %This counts and stores the proportion that is 'I' at each time step
        for k=1:N;
            if current(k)==1
                count=count+1;
            end
        end
        I_t(1,s)=I_t(1,s)+count/N;
         
        char(current);
        
    %%% SI élek leszámlálása
        
        for i=1:N
            for j=1:N
                if current(i)==0 && current(j)==1 && G(i,j)==1
                    SI_t(1,s)=SI_t(1,s)+1;
                end
    
                if current(i)==1 && current(j)==0 && G(i,j)==1
                    SI_t(1,s)=SI_t(1,s)+1;
                end
            end
        end
        
        for i=1:N 
            if current(i)==0 
                
                SI=0;
                Tot_rate=0;
                    for j=1:N % SI élek számlálása
                        if current(j)==1 && G(i,j)==1
                            SI=SI+1;
                        end
                    end
                Tot_rate=tau*SI; % SI*ráta
                P=1-exp(-Tot_rate*dt); % Elo fv.
                R=rand; % [0..1] rand szám
                if R<P
                    future(i)=1;
                else
                    future(i)=0;
                end
            else
                P=1-exp(-gam*dt);
                R=rand;
                if R<P
                    future(i)=0;
                else
                    future(i)=1;
                end
            end
        end
        
        current=future; %Syncronous updating - check all nodes then make the change at the same time
    end
end

I_t=I_t/Reps;%Average over the reps
SI_t=SI_t/(2*N^2*Reps); % i-j miatt
S_t=1-I_t;

plot(t,I_t)