I want to generate 1billion random integer with no duplication, I dont know how do I allocate memory for such a huge amount of data.
Jump to Post
Well, there is an easier and more efficient way to generate non-repeating random numbers. The algorithm is:
generate all the (non random) sequential numbers you need, and put them into an array (any data structure would perhaps do, but an array is easy).
Then shuffle the numbers in …
All 3 Replies
Be a part of the DaniWeb community