function [Nuc] = maketrinuc(size,N)

PLOT=0;

TriNuc = {'TGG'; 'GGT'; 'CTG'; 'CCG'; 'CGT'; 'AAC'; 'AAA'; 'ATG'; 'GAA'; 'CAG'; ...
          'GCT'; 'CAT'; 'TCT'; 'GAC'; 'ACT'; 'TTC'; 'GTT'; 'ATC'; 'TAC'};

% remember that random number generator makes zeros
% we need integer values 1 ... 19
R = floor( rand([size N])*(numel(TriNuc)) ) + 1; 

if PLOT
    figure(100);
    hist(R,0:1:20);
    xlim([0 20]);
    set(gca,'xtick',1:20);
    xlabel('trunucleotides');
    ylabel('frequency');
    legend(gca,{'AA1'; 'AA2'; 'AA3'; 'AA4'}, 'location', 'EastOutside');
end

Lib = cell(size,N);

for i=1:numel(TriNuc)
    Lib(R==i) = TriNuc(i);
end

cLib=[];
for i=1:N
    cLib = [cLib char(Lib(:,i)) ];
end

Nuc=cellstr(cLib);
end