You might want to consider the following -
Put the code for generating a random number into a
function. Call the function every time you want to
generate a number for the sets. Store the generated
numbers in different variables or in an array. If the
number generated by the function is the same as the
value already stored in the variables or array member,
then you can call the function once again. So you keep
calling the function again and again till you find a
Hope this helps,
--- Jon Carlos <j.b.carlos@w...> wrote:
> I'm currently programming a game of Bingo and want
> to randomly generate
> the called numbers and put them in a database.
> The numbers go like this:
> Set 1 numbers 1 to 15
> Set 2 numbers 16 to 30
> Set 3 numbers 31 to 45
> Set 4 numbers 46 to 60
> Set 5 numbers 61 to 75
> No I can generate this with this code:
> Dim rnum(10,5)
> For a = 1 to 5
> For i = 1 to 10
> rnum(i,a) = Int((rmax - rmin +1) * Rnd + rmin)
> Rmax = cint(rmax) + 15
> Rmin = cint(rmin) + 15
> But I dont want to have duplicate numbers in any of
> the sets.
> As I can see it there are two ways of checking for
> 1: at the begining when generating the numbers
> 2: after all the numbers are generated
> Problem 1 is I dont know to check for the duplicates
> Problem 2 is I dont know how to replace the
> duplicates with numbers that
> havent been chosen.
> Please Please Help
> Thanks In advance
> http://www.asptoday.com - the leading site for
> in-depth information for ASP developers everywhere.
> You are currently subscribed to proasp_codeclinic
> as: kk8877@y...
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.