Hi, I'm needing to generate a list of 10,000 different numbers between -1 and 1. I then have to arrange them in ascending order. Basically I have one array(randomnum[]) filled with the random numbers and I am filling another one(position[]) with the numbers in ascending order. I'm not entirely sure if how I'm generating the numbers is correct, but I feel like everything else is correct. Any help would be appreciated.
Those are awful big arrays to allocate on the stack. I don't think you really need the position array unless you need to preserve the original order for some reason.
I do need to keep the originally generated list (generatednum[]). I've checked that list and it is only producing -1s and 0s (0000-100-1-10-1 etc.). Definitely something wrong with my rand()
Thank you that worked. Now however, my sorted list is wrong, haha. I believe what's happening is that I'm generating a new list for every iteration of i, so it's using different numbers each time. Could I just define