function [stat,post] = blkurand(path,prop,bstr,bint,bflt,parent,name,catalog,ws,node,sbSample)
%BLKURAND Generates a uniform random number sequence.
%
% See also BLKGENWAVE, BLKPULSE, BLKSTEP, BLKSQWAVE, BLKLIMRAMP, BLKSINEGEN, BLKNORMAL.
%

% Initial coding by A S Bozin, 6-10-97
% Copyright 1997-2000 The MathWorks, Inc.
% $Revision: 1.6 $ $Date: 2000/06/14 16:11:38 $

   stat = 0;			   		   % Error flag
   nInputs = bint(5);
   nOutputs = bint(6);
   %
   % Build mux and demux if necessary
   %
   channels = 0;
   [post,rect] = blkio('port',channels,nOutputs,prop,path);
   %
   % Get the seed, relative start time, minimum, maximum, output interval and
   % interpolation method parameters
   %
   indInt = bint(15)+1;
   indStr = bint(17)+1;
   mode = bint(indInt);
   npar = 5;					   % Number of parameters
   symInd = zeros(1,npar);
   if (bitand(mode,16))
      indInt = indInt+2;
      iRange = 1:bint(indInt);
      symInd(bint(indInt+iRange)) = 1;
   end
   str = cell(npar+1,1);
   for (k = find(symInd))
      ind = mfindstr(bstr,indStr,'|');
      str{k} = bstr(indStr:ind-1);
      indStr = ind+1;
   end
   indInt = bint(18)+1;
   indInt = bint(indInt)+indInt+nOutputs;	   % Skip icon data and seeds
   typ = {'Constant';'Linear'};
   str{end} = typ{bint(indInt)};
   %
   % Get the block parameter variables
   %
   [symInd,str] = mgetscope(symInd,str,catalog,ws,node);
   indInt = bint(18);
   indInt = bint(indInt+1)+indInt;		   % Skip icon data
   indFlt = bint(19);
   pLen = zeros(npar,1)+nOutputs;
   pLen(end) = 1;				   % Output interval parameter
   ub = [pLen(1);cumsum(pLen(2:end))];
   lb = [zeros(2,1);ub(2:end-1)]+1;
   for (k = find(~symInd))
      params = zeros(1,pLen(k));
      bRange = lb(k):ub(k);
      switch (k)
	 case 1
	    params(:) = bint(indInt+bRange);
	 otherwise
	    params(:) = bflt(indFlt+bRange);
      end
      str{k} = mat2char(params);
   end
   %
   % Uniform random number block
   %
   if (any(sbSample))
      bh = add_block('libsb2sl/SNG/DUniformRandom',path,...
		     'ForegroundColor',prop.fgColor,...
		     'BackgroundColor',prop.bgColor,...
		     'Orientation',prop.orientation,...
		     'DropShadow',prop.border,...
		     'Position',rect,...
		     'SEED',str{1},...
		     'T0',str{2},...
		     'MIN',str{3},...
		     'MAX',str{4},...
		     'TS',mat2char(sbSample));
   else
      bh = add_block('libsb2sl/SNG/CUniformRandom',path,...
		     'ForegroundColor',prop.fgColor,...
		     'BackgroundColor',prop.bgColor,...
		     'Orientation',prop.orientation,...
		     'DropShadow',prop.border,...
		     'Position',rect,...
		     'SEED',str{1},...
		     'T0',str{2},...
		     'MIN',str{3},...
		     'MAX',str{4},...
		     'INTM',str{6},...
		     'TS',str{5});
   end
   %
   % Connect the current block with the mux and demux blocks (if any)
   %
   blkio('line',channels,nOutputs,post,parent,name);
   return					   % Last card of BLKURAND
