## Author: M. Turhan ÇOBAN
## Created: 2021-06-20
## set_genotype

function retval = set_random_genotype(fx,xmin,xmax,ngene,no)
  N=64;
  N1 = 9223372036854775807;
  genotype.no=no;
  genotype.xmin=xmin;
  genotype.xmax=xmax;
  genotype.ngene=ngene;
  genotype.f=fx; 
  for i=1:genotype.ngene
    xp=N1*rand;
    genotype.x(i)=double(xmin(1,i)+xp*(xmax(1,i)-xmin(1,i))/N1);
    xx=double_to_binary (genotype.x(i),genotype.xmin(1,i),genotype.xmax(1,i));    
    genotype.b(i,:)=xx;
  endfor
  genotype.y=fx(genotype.x);
  genotype.RFitness=genotype.y;
  genotype.RCFitness=genotype.y;
  retval =genotype;  
endfunction