Hi all,
I would like to find a function like the Matlab function randperm() in Mata, which randomly selects rows of a matrix and reorder these selected rows. sample() or bsample() are for Stata variables. I tried to use rdiscrete() to selecet row indexes first. But the problem is that rdiscrete() would return double indexes. I am wondering whether there is a function in Mata can fulfill this task. Thanks.
I would like to find a function like the Matlab function randperm() in Mata, which randomly selects rows of a matrix and reorder these selected rows. sample() or bsample() are for Stata variables. I tried to use rdiscrete() to selecet row indexes first. But the problem is that rdiscrete() would return double indexes. I am wondering whether there is a function in Mata can fulfill this task. Thanks.
Comment