• Want to take part in this year's BoS Trials event for Maths and/or Business Studies?
    Click here for details and register now!
  • YOU can help the next generation of students in the community!
    Share your trial papers and notes on our Notes & Resources page

Storing numbers (1 Viewer)

geniass

New Member
Joined
Oct 11, 2003
Messages
26
For my major project I am generating random numbers, within a module, but I want to be able to store these numbers, so that if they are generated again later, it will not use them, instead generate a new number . ANy ideas?..


jbtFan
 

Winston

Active Member
Joined
Aug 30, 2002
Messages
6,128
Gender
Undisclosed
HSC
2003
There is an inefficient method you could use, to do it...

for every number you generate, you add it to an array list,

and everytime you generate a number, you traverse through the array and compare it with the new generated number, if the number is in the array, the generate number function will be invoked again, until a new number is generated.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top