i've sudoku to make and for that, i need to generate it too. so for the generation, i've decided out that filling each successive column is a task of filling each column cell in the same row with a random no but seeing that it isn't already there in that row before.
i've seen topics on random function but they are hardly the thing i want.
suppose already the numbers 3,4,7 are entered, then i want to enter a random number from the rest of the numbers left from 1-9 except the 3,4,7. so how do i do that? is there a particular function for that? generating a random no but with excluding a particular set of numbers?
to do that in the most basic and primitive way as possible i deviced a method in which i will do a linear search on the previous elements and see if the currently generated random # is there or not, if not then obviously put it in the array. otherwise generate another random no until i get something unique.
but its so time consuming and inefficient...would hog up system time i guess.
so please help me with this.
i can't go further in my generate function of sudoku without having this figured out