You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: bino_rnd.m
    path of file: ./repos/malini/Codes/FC_EC_calculation code/DynamicFC/jplv7/distrib
    
    the code of the file until where you have to start completion: function rnd = bino_rnd (n, p, r, c)
% PURPOSE: random sampling from a binomial distribution
%---------------------------------------------------
% USAGE: rnd = bino_rnd(n,p,r,c)

    
function rnd = bino_rnd (n, p, r, c)
% PURPOSE: random sampling from a binomial distribution
%---------------------------------------------------
% USAGE: rnd = bino_rnd(n,p,r,c)
% where: p = the probability of success
%        n = number of trials
%        r,c = size of random sample from binominal(n,p) distribution
%---------------------------------------------------
% RETURNS:
%        rnd = matrix, vector or scalar of random deviates
%              equal to the number of successes in n-trials 
% NOTE: mean = n*p, variance = n*p(1-p)
% --------------------------------------------------
% SEE ALSO: bino_d, bino_pdf, bino_cdf, bino_inv
%---------------------------------------------------

% NOTES: Written by KH (Kurt.Hornik@ci.tuwien.ac.at)
% converted to MATLAB by
% James P. LeSage, Dept of Economics
% University of Toledo
% 2801 W. Bancroft St,
% Toledo, OH 43606
% jlesage@spatial-econometrics.com


  if (nargin == 4)
    if ~(is_scalar (r) & (r > 0) & (r == round (r)))
      error('bino_rnd:  r must be a positive integer');
    end