I am writing a program that involves placing one number into each cell of a 7x7 grid. There are 56 numbers, chosen from at random, and there must be no repetition.
The end result should be a 7x7 grid in which each cell contains an integer from 1 to 56, with no two cells containing the same number. What is the most efficient way of doing this?
extra words: I tried creating a for x{for y{}} that would go through the grid cell by cell and add a random number 1-56. It would then check a 56-slot array to see if that number was already in use, and correspondingly either re-roll or accept the number, then flag the array to mark the number as in use. For some reason, I couldn't get it to work, and it seemed like a bad solution. I scrapped it, and instead had a second for x{for y{}} run each time and check the entire grid cell by cell for the rolled number before approving or rejecting it. This also didn't quite work and seemed unwieldly, so I scrapped it as well.