I agree Artur. I was recently in need for a resample without replacement function.
I have not check your code but I had a look on what I did and it could be a refinement (following also Sven's answer).
Say a matrix A is nxm.
set k<=m.
rvec = ranking( mrandgen(u,0,1,m,1) )'
A=[,rvec[1:k]]
(keeps k randomly selectled columns of A)
I would like to see such a function in extra.gfn
Yiannis
**************************************************************************************************
Ioannis A. Venetis, Associate Professor
University of Patras, School of Economic Sciences and Business Administration,
Department of Economics
University Campus, Rio, 26504, Greece Tel: 0030 2610 969964
http://www.econ.upatras.gr/en/people/teaching-staff/venetis-ioannis
https://sites.google.com/site/ioannisavenetis/
**************************************************************************************************