+ Reply to Thread
Results 1 to 7 of 7

random number issue

Hybrid View

  1. #1
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: random number issue

    Either use Randomize without an argument, or use Randomize Application.WorksheetFunction.Randbetwwen(1,999999).

    That said, worksheet RAND() and RANDBETWEEN() use much better pseudorandom number generators than VBA's Rnd. If I recall correctly, VBA's Rnd uses an 1970s era linear congruential generator. MSFT updated Excel's worksheet RAND() to reflect a few extra decades of numerical programming research in Excel 2003 and more in Excel 2007.

    If you need to do serious Monte Carlo simulations, you should be using a real stats package rather than ANY spreadsheet, but if you have to use Excel, you'd actually be much better off using Application.WorksheetFunction.Rand() and consigning VBA's Rnd to the oblivion it deserves.

  2. #2
    Forum Contributor
    Join Date
    05-13-2019
    Location
    Halifax, Canada
    MS-Off Ver
    2016
    Posts
    176

    Re: random number issue

    Thank you hrlngrv,

    I found worksheet RAND() better alternative for my Monte Carlo Simulation. Thank you for sharing this valuable knowledge.

    Roshan

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Random issue when running macro
    By Karenba in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-24-2018, 12:22 AM
  2. Random Number - Random Selection
    By stribor40 in forum Excel General
    Replies: 5
    Last Post: 05-24-2017, 02:52 PM
  3. [SOLVED] Random numbers but each number not eqully random.
    By richhhh in forum Excel General
    Replies: 11
    Last Post: 09-06-2016, 01:16 PM
  4. Replies: 5
    Last Post: 06-21-2013, 10:40 AM
  5. [SOLVED] Generate random 6-16-byte random hexadecimal number
    By jsamuelshn in forum Excel General
    Replies: 6
    Last Post: 07-20-2012, 10:38 AM
  6. Generating a Random Number of Random Numbers
    By Garrus in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-10-2010, 09:39 AM
  7. [SOLVED] How do I find random number in list of random alpha? (Position is.
    By jlahealth-partners in forum Excel General
    Replies: 0
    Last Post: 02-08-2005, 02:06 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1