Random Number Genarator

B

Bryan

I need to be able to generate a random sample of numbers, say 1-1000. no
number can be repeated. i can generate the sample, but i have duplicates.
what i am looking for is to be able to not have duplicates.

also, if i had to select a random cell out of this sample, how would i go
about doing that?
 
J

Joel

to generate unique random number, you need to check the list of previous
number to make sure the number wasn't previously picked.

The other method is to create a llist of number 1-1000 (either in an array
or on the spreadsheet). Assign a random number to each of the 1000 number (2
dimensional array or 2nd column of spreadsheet). Then sort the list by the
random numbers.

Selecting a random cell is choosing a random number. If you had cells A1:A70

Randrow = int(70 * rnd()) + 1

Range("A" & RandRow).select
 
M

Mike H

As soon as you apply caveats then the numbers aren't random and to get 1000
numbers you need a fairly large sample. However, one way

1-65536 in A1:A65536 then in B1 put =RAND(), copy down to B65536, now select
both columns and sort by column B, select the first 1000 numbers in Column A.

Mike
 
B

Bryan

well the array is what is throwing me off. i need my numbers to be in a
range of say 25 rows 30 columns.
 
B

Bernd P

Hello,

Well, J.E.'s function and my function UniqRandInt (see www.sulprobil.com)
can handle that:
Just select your array and array-enter the (Uniq)RandInt formula.

Regards,
Bernd
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top