Get a particular unused number within a particular range
Ineed to create a function that would give a particular number within a particular range. Sample you are assigning an id for an item. Giving only numbers id in a particular range. But number the item could be manual and also auto generated. But during the auto generated it should also get inside this range and it should be the unused one.
Scenario: Number range 0001 - 9999
I have to pick the UNUSED number inside this range,
0001 - unused
0002 - used
0003 - unused
0004 - unused
0005 - used
...
On the give above, when i kicked the function it should give me first the 0001 as it is unused then it should jump to the next unused number which is 0003.