added code for randomized projection