2 Replies - 2360 Views - Last Post: 25 July 2012 - 06:56 AM

#1 GtakriZ  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 18-July 12

Problem on implementing an idea in web development

Posted 18 July 2012 - 12:38 AM

Hello to all of you,

I just registered here, because I wanted help on implementing a programming idea I had the past days.
I am kind of new in programming generally and I found it a good idea to ask here first.

So, let's say I have about 900 sets of 6 numbers stored somewhere (maybe in arrays?). I want each time to generate a random set of 6 numbers that is different than the other 900. If it is the same (check with the other 900), then don't accept it and generate a new. I thought of using arrays and check the new set with the others each time, but I think it's a little "painful" to have 900 arrays before.

Any ideas would be appreciated! Thanks! :)

Is This A Good Question/Topic? 0
  • +

Replies To: Problem on implementing an idea in web development

#2 BenignDesign  Icon User is offline

  • holy shitin shishkebobs
  • member icon




Reputation: 5753
  • View blog
  • Posts: 10,077
  • Joined: 28-September 07

Re: Problem on implementing an idea in web development

Posted 23 July 2012 - 01:00 PM

Store it in a database and use a loop to check for duplicates?
Was This Post Helpful? 0
  • +
  • -

#3 astian  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 23
  • Joined: 15-June 12

Re: Problem on implementing an idea in web development

Posted 25 July 2012 - 06:56 AM

Um, if you cant or dont want to use a database, you might want to use a List<> to store your 900 sets of numbers, this way you have a dynamic container in which you can add and remove items. If your sets are in a type that can be compaired with a - thelistWithTheSets.Contains(therandomSet) will save you some writing of iterations.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1