Author Topic: Removing a random number from a list  (Read 796 times)

Malic

  • Full Member
  • ***
  • Posts: 102
Removing a random number from a list
« on: April 02, 2021, 02:52:27 PM »
Picking a random number between 0000 and 9999.  How to make it so it removes that number from future random picks so it does not double up until it has completed what I need it to do?

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4758
  • RTFM
Re: Removing a random number from a list
« Reply #1 on: April 02, 2021, 02:59:17 PM »
You could store the number(s) that have already been picked, then check whether the newly generated number equals a stored number, and if so generate another new random number and repeat that cycle until the outcome is a number that hasn't been picked yet.