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: palm_randg.m
    path of file: ./repos/CBIG/external_packages/matlab/non_default_packages/palm/palm-alpha109
    
    the code of the file until where you have to start completion: function g = palm_randg(a,siz)
% Generate random Gamma variables.
%
% g = palm_randg(a,siz)
%
% a   : Parameter A (= k) of the Gamma distribution. The shape

    
function g = palm_randg(a,siz)
% Generate random Gamma variables.
%
% g = palm_randg(a,siz)
%
% a   : Parameter A (= k) of the Gamma distribution. The shape
%       (or rate) parameter is fixed at 1.
% siz : A vector indicating the size of the array to be created.
% g   : Gamma-distributed variables.
%
% Reference:
% * Marsaglia G, Tsang WW. A simple method for generating gamma
%   variables. ACM Trans Math Softw. 2000;26(3):363-372.
%
% _____________________________________
% Anderson M. Winkler
% FMRIB / University of Oxford
% May/2015
% http://brainder.org

if exist('randg','builtin') || exist('randg','file'),
    
    % randg is a build-in in Octave, and a MEX in Matlab in the 
    % Stats Toolbox. If it's available, let's use it.  It's
    % about 4x faster in Octave, and 6x times faster in Matlab.
    g = randg(a,siz);
    
else
    
    % Constants for below
    if a < 1,
        d = 1+a-1/3;
    else
        d = a-1/3;
    end