random number in VBScript

Results 1 to 3 of 3

Thread: random number in VBScript

  1. #1
    Demi salloni Guest

    Default random number in VBScript

    how to get a random number in VBScript the number should be between 1 to 1 lakh and it should not be a repeated number,atleast not consucatively.

  2. #2
    Join Date
    Dec 1969

    Default RE: random number in VBScript

    The first part of your request is pretty easy.<BR><BR>x = int(rnd * max) + 1<BR><BR>The second part is not as easy. There is no guarantee with any random number generator that a number will not repeat.<BR><BR>Most of the time people ask for this, it&#039s because they want a unique record ID of some sort for their database. Is that why you are asking as well? If so, you should consider using identity fields (in SQL Server) or the AutoNumber feature in Access) for that purpose. If not, then perhaps if you explain how you want to use this, we could help you come up with a robust system that will not repeat within a given range.

  3. #3
    Join Date
    Dec 1969

    Default RE: random number in VBScript

    try the VBScript Reference (link to the left)<BR><BR>j

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts