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: munifboxrnd.m
    path of file: ./repos/vbmc/shared
    
    the code of the file until where you have to start completion: function r = munifboxrnd(a,b,n)
%MUNIFBOXRND Random arrays from the multivariate uniform box distribution.
%   R = MUNIFBOXRND(A,B) returns an N-by-D matrix R of random vectors
%   chosen from the multivariate uniform box distribution with bounds A and
%   B. A and B are N-by-D matrices, and MUNIFBOXRND generates each row of R 
%   using the corresponding row of A and B.
%

    
function r = munifboxrnd(a,b,n)
%MUNIFBOXRND Random arrays from the multivariate uniform box distribution.
%   R = MUNIFBOXRND(A,B) returns an N-by-D matrix R of random vectors
%   chosen from the multivariate uniform box distribution with bounds A and
%   B. A and B are N-by-D matrices, and MUNIFBOXRND generates each row of R 
%   using the corresponding row of A and B.
%
%   R = MUNIFBOXRND(A,B,N) returns a N-by-D matrix R of random vectors
%   chosen from the multivariate uniform box distribution with 1-by-D bound
%   vectors A and B.
%
%   See also MUNIFBOXPDF.

% Luigi Acerbi 2022

[N,D] = size(a);
[Nb,Db] = size(b);

if nargin < 3 || isempty(n)
    n = N;
else
    if (N ~= 1 && N ~= n) || (Nb ~= 1 && Nb ~= n)
        error('munifboxrnd:SizeError', ...
            'A and B should be 1-by-D or N-by-D arrays.');
    end