+ Reply to Thread
Results 1 to 5 of 5

Using randbetween function to apply a decimal advantage

  1. #1
    Registered User
    Join Date
    12-25-2018
    Location
    Denver, Colorado
    MS-Off Ver
    Excel
    Posts
    5

    Using randbetween function to apply a decimal advantage

    In studying a card game using Excel I found the randbetween function, but it does not allow negative numbers. I want to in essence flip a coin that has a 1.34% bias. I used randbetween 0 and 200134, set less than 10000 to be a loss and over 10000 to be a win. It should therefore be a win 1.34% more often from my calculations. Was there an easier way to do this?
    Last edited by 6StringJazzer; 12-26-2018 at 10:58 PM. Reason: Moved from Excel Programming / VBA / Macros

  2. #2
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    1,899

    Re: Using randbetween function to apply a decimal advantage

    How is less than 10,000 equal to 1.34%? Isn't it 10,000 / 200,134 which is about 4.99%?

    I would have used 0 and 10,000 as th limits. Any value less than 134 is 1.34%

    Edit - on reading your post again I think I misunderstood and you'r weighting one flip at 1.34% higher than the other.

    If so the first thing is use 20,134 not 200,134
    Last edited by Crooza; 12-26-2018 at 09:30 PM.
    Happy with my advice? Click on the * reputation button below

  3. #3
    Forum Expert
    Join Date
    10-15-2018
    Location
    MA, USA
    MS-Off Ver
    2010, 2019
    Posts
    1,310

    Re: Using randbetween function to apply a decimal advantage

    First I just want to check if your math is right.
    When you say you want the coin to have a 1.34% bias do you mean that 51.34% of tosses on average will result in a "win"? If so, 51.34% of 200134 = 102749, so your breakpoint between a win and a loss would be 102749, not 10000.

    Secondly, can't you simply use rnd() then:
    if rnd() > 0.5134 "win" else "loss"

  4. #4
    Forum Moderator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    365
    Posts
    17,739

    Re: Using randbetween function to apply a decimal advantage

    I would not use RANDBETWEEN, but rather Rnd. You have not shown VBA code but you posted in a VBA forum. So here is the code I would use:
    Please Login or Register  to view this content.
    Remember--these are pseudo random numbers. So you will not consistently meet your percentage. The bias will approach that percentage over a very large number of trials.

    Also this does what your numbers show in the first post but this is not the same as "It should therefore be a win 1.34% more often". If you want the number of wins to be 101.34% of the number of losses then your math is not right.
    Last edited by 6StringJazzer; 12-26-2018 at 09:34 PM.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  5. #5
    Registered User
    Join Date
    12-25-2018
    Location
    Denver, Colorado
    MS-Off Ver
    Excel
    Posts
    5

    Re: Using randbetween function to apply a decimal advantage

    I posted in the wrong forum, hope its okay to answer. Thanks for the help on this, I was going to fast, too sloppy. It was fun coming up with the idea though. I love this stuff.

+ 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. RANDBETWEEN Function with conditions
    By Jumpingbeans_8 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-26-2020, 05:38 PM
  2. Replies: 10
    Last Post: 07-03-2015, 04:29 PM
  3. If and Randbetween Function
    By dr_phd1 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-19-2013, 04:02 PM
  4. RANDBETWEEN function capped
    By derek594 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-30-2013, 11:14 PM
  5. Randbetween Function
    By CV_GAS in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-24-2008, 03:45 PM
  6. Freezing the RANDBETWEEN function
    By zuri125 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-11-2008, 01:58 AM
  7. randbetween function
    By Tracey in forum Excel General
    Replies: 5
    Last Post: 02-10-2006, 08:35 PM

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