-2

I'm new to vbscript.

I've got this so far

Function random_number_generator (lowerLim, upperLim)
    Randomize
    randNumber = Int(((upperLim-lowerLim+1)* Rnd())+ lowerLim)
    random_number_generator = randNumber
End Function

But how do I make it to have a sequence for generating let's say 9 digit social security number?

for example if the first social security is 200030886 next would be 200030887 and so on.

jeesan485
  • 147
  • 5
  • 14
  • A 9-digit number is just any number between 0 and 999999999, so all you need to do is adjust your upper and lower limits accordingly. – Simon MᶜKenzie Dec 23 '14 at 04:34
  • Can you post what you need the output to look like. Please include a couple of examples – Spock Dec 23 '14 at 04:34

2 Answers2

2

I'm not sure why you have a random element to your question. I seems like you just want a counter?

Dim start, ends
start = 200030886
ends = 200040000

for k = start to ends
    MsgBox k
next

If you need a random number formatted like the numbers above, you can try this.

MsgBox random_number_generator(1, 10000)

Function random_number_generator (lowerLim, upperLim)
    Randomize
    randNumber = Int(((upperLim-lowerLim+1)* Rnd())+ lowerLim)
    random_number_generator = "2" & RIGHT("000000000" & randNumber, 8)
End Function

Hope that helps

Spock
  • 4,700
  • 2
  • 16
  • 21
-2
Dim RandNumber

RandNumber = RandomNumber(1,10000)

Print RandNumber
Paul Roub
  • 36,322
  • 27
  • 84
  • 93