Solved

Generating a random number

Posted on 1998-12-18
2
190 Views
Last Modified: 2012-05-04
How can I generate a random number which will be unique.
0
Comment
Question by:lesa
2 Comments
 
LVL 13

Accepted Solution

by:
Mirkwood earned 10 total points
ID: 1451293
Randomize Statement Example
This example uses the Randomize statement to initialize the random-number generator. Because the number argument has been omitted, Randomize uses the return value from the Timer function as the new seed value.

Dim MyValue
Randomize   ' Initialize random-number generator.

MyValue = Int((6 * Rnd) + 1)   ' Generate random value between 1 and 6.

0
 

Expert Comment

by:Shroom
ID: 1451294
'One way that you could do it is like this:
'This will give u a randome number beetween 1 and 100

Randomize Timer
I = int(rnd * 100)

0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

28 Experts available now in Live!

Get 1:1 Help Now