Use a Knuth shuffle or something. That is generate an array which contains values in a certain range of numbers, then shuffle them, then just iterate through array to get your unique random numbers. - Lev Neiman
On Sat, Sep 25, 2010 at 2:47 PM, Erick Njenga <[email protected]> wrote: > That would mean that I have to check for duplicates in the database each > time a new number is generated. or do you have pointers to random number > generators which guarantee uniqueness? > > > On Sat, Sep 25, 2010 at 8:52 PM, Lev Neiman <[email protected]> wrote: > >> Your problem is that you need to create random values to put on each >> scratch card? Why not just use rand() or some more advanced random number >> generator? >> - Lev Neiman >> >> >> On Sat, Sep 25, 2010 at 8:37 AM, Erick Njenga <[email protected]>wrote: >> >>> I'm creating an application that involves scratch-cards and would like to >>> know what solutions are available for generating the numbers. Any hash >>> function suggestions? >>> >>> -- >>> >>> Thanks and Regards, >>> Erick Njenga Nyachwaya, >>> M: +254-725-008-790 >>> >>> <http://www.facebook.com/ErickNjenga><http://www.twitter.com/ErickNjenga> >>> >>> >>> >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "google-codejam" group. >>> To post to this group, send email to [email protected]. >>> To unsubscribe from this group, send email to >>> [email protected]<google-code%[email protected]> >>> . >>> For more options, visit this group at >>> http://groups.google.com/group/google-code?hl=en. >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "google-codejam" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]<google-code%[email protected]> >> . >> For more options, visit this group at >> http://groups.google.com/group/google-code?hl=en. >> > > > > -- > > Thanks and Regards, > Erick Njenga Nyachwaya, > M: +254-725-008-790 > > <http://www.facebook.com/ErickNjenga> <http://www.twitter.com/ErickNjenga> > > > > > -- > You received this message because you are subscribed to the Google Groups > "google-codejam" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<google-code%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/google-code?hl=en. > -- You received this message because you are subscribed to the Google Groups "google-codejam" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-code?hl=en.
