Generate an Array of Unique Random Numbers

Category:
Lists, Collections and Arrays
Type:
Snippets
Difficulty:
Intermediate
Author:
Brian Gillham

Version Compatibility: Visual Basic 5

More information:
This function will generate an ARRAY of TRULY random numbers. By default they are unique but this is a parameter which can be parsed. Useful for generating Lottery Numbers etc. I tried searching the net but could not find anything that could do this with the simplicity of this function. See comments within code for full explanation and sample.

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: