Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 186
Default Random Number Array

I have a variable number (RecordCount) and I want to select 15 random numbers
from it and stuff them into an array. I suspect the following code won't
preclude the possibility of getting repeat numbers. How do I insure that each
of the 15 numbers will be unique?

Opiton Explicit
Option Base 1
Dim Iloop as Double
Dim RecordCount as Double

For ILoop = 1 To 15
RndNo(ILoop) = Int((RecordCount * Rnd) + 1)
Next ILoop

--
Ken Hudson
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Random Number Array

I'd start by looking at JE McGimpsey's site:

http://www.mcgimpsey.com/excel/udfs/randint.html

Ken Hudson wrote:

I have a variable number (RecordCount) and I want to select 15 random numbers
from it and stuff them into an array. I suspect the following code won't
preclude the possibility of getting repeat numbers. How do I insure that each
of the 15 numbers will be unique?

Opiton Explicit
Option Base 1
Dim Iloop as Double
Dim RecordCount as Double

For ILoop = 1 To 15
RndNo(ILoop) = Int((RecordCount * Rnd) + 1)
Next ILoop

--
Ken Hudson


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Array? Put values from random columns into 4 willwonka Excel Worksheet Functions 4 March 16th 07 05:20 PM
Discrete random numbers into an array? festdaddy Excel Programming 4 August 21st 06 10:35 PM
How can I match a random number with closest number from sequence? Matt Excel Worksheet Functions 4 August 3rd 06 01:22 AM
random mumber array jedg Excel Programming 3 March 31st 06 03:43 PM
How do I find random number in list of random alpha? (Position is. jlahealth-partners Excel Discussion (Misc queries) 0 February 8th 05 05:31 PM


All times are GMT +1. The time now is 05:52 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"