I need to generate a random NxK matrix (where N > K), where the columns K are orthogonal random vectors.
An option I tried is to generate a squared orthogonal matrix with size NxN and then select the first K columns, but I wonder if there is a more efficient way of doing so.
Current code (in R):
library(pracma)
Z <- rortho(N)[,1:K]