Is there an algorithm to generate an array containing all the numbers up to N, while using the rand() function?
The problem is that rand() can return the same number, so I need a trick to avoid that.(Meaning generating the numbers in one go, without using the rand() function more than N time)
Edit: The numbers must be a result of the rand() function. Meaning the array needs to be filled using the rand() function N times. (And not hard writing N numbers and then shuffling them)
Thanks in advance!