Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Random Number Genarator
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? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Random Number Genarator
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 "Bryan" wrote: 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? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Random Number Genarator
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 "Bryan" wrote: 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? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Random Number Genarator
Take a look he
http://www.mcgimpsey.com/excel/udfs/randint.html In article , Bryan wrote: 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? |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Random Number Genarator
well the array is what is throwing me off. i need my numbers to be in a
range of say 25 rows 30 columns. "Joel" wrote: 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 "Bryan" wrote: 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? |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Random Number Genarator
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Addding a Random number to a fixed number..... | Excel Discussion (Misc queries) | |||
How can I match a random number with closest number from sequence? | Excel Worksheet Functions | |||
same number appears in a random number generator | Excel Worksheet Functions | |||
Generating (in a random order)each number once from a given number | Excel Worksheet Functions | |||
How do I find random number in list of random alpha? (Position is. | Excel Discussion (Misc queries) |