function [a,b] = AI_choose_rand(attributes,examples)
%
% AI_choose_rand - choose attribute randomly
% Call:
%     v = AI_choose_rand(a,e);
% On input:
%     examples (mxn array): training set
% On output:
%     a (integer): attribute index chosen
% Custom functions used:
%     none
% Author:
%     T. Henderson, UU, 11/2002
% Method:
%      

b = 0;
OK_indexes = [];
num_attributes = length(attributes);
for a = 1:num_attributes
   if attributes(a).include==1
      OK_indexes = [OK_indexes; a];
   end
end
if isempty(OK_indexes)
   v = 0;
   return
end
num_OK = length(OK_indexes);
a = OK_indexes(ceil(rand*num_OK));
