function  vecout = bootsample(vecin)
% Bootstraping from the array "vecin" by random selecting the rows
% Usage
%   vecout = bootsample(vecin)
% Input
%   vecin - nxp data matrix, if it is vector it has to be a column.
%   n - sample size
%   p - dimension of a single observation
% Output
%   vecout - a single bootstrap sample, size n x p.
% Example
%   bootsample([1 2; 2 3; 3 4; 4 5]) 
%   ans =
%      4     5
%      3     4
%      4     5
%      3     4
% BV 10/20/02

[n, p] = size(vecin);  
selected_indices = floor(1+n.*(rand(1,n)));
vecout = vecin(selected_indices,:);

