simple random indexing implementation