| bennyboy (15) | |||
|
I am trying to populate an array with random but unique integers for later use in a minesweeper game. I am not very familiar with rand and srand. Here's an example from what I have been trying:
This populates randarray with 5 random integers ranging from 1 - 5. However they are not UNIQUE. How can I fix this? | |||
|
Last edited on
|
|||
| ResidentBiscuit (2655) | |
|
Read this. This discusses a couple of widely used ways to achieve this: http://stackoverflow.com/questions/1608181/unique-random-numbers-in-an-integer-array-in-the-c-programming-language | |
|
|
|