Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function RANDBETWEEN outputs bounding numbers at half the frequency of other outputs #2704

Open
1 task done
Dahkahtah opened this issue Apr 21, 2024 · 1 comment
Open
1 task done
Labels
confirmed-bug Issues with confirmed bugs

Comments

@Dahkahtah
Copy link

This issue is unique.

  • I have used the search tool and did not find an issue describing my bug.

Operating System of DocumentServer

Linux (DEB package)

Version information

8.0.1.31

Expected Behavior

For example, RANDBETWEEN(1,3) should have an equal one third chance to output the numbers 1, 2, or 3. With a sufficiently large number of rolls, the relative frequency of each digit should approach 33.3%.

Actual Behavior

For RANDBETWEEN(1,3), the frequency of the digits 1, 2, and 3 after 10,000 rolls is approximately 25%, 50%, and 25% respectively. This off-balance behaviour is consistent among all RANDBETWEEN input values I've tested where the difference between the top value and bottom value is more than one.

Reproduction Steps

  1. Use RANDBETWEEN(x, y) where x and y are integers and y > x + 1
  2. Fill enough cells with formula in step 1 to have a sufficiently large sample size
  3. Count instances of each integer output between x and y and divide each by the sample size

Additional information

A spreadsheet containing the frequencies of outputs for all valid combinations between 1 and 20 after 10,000 rolls is attached for your reference.
dice_roll_calc_test.xlsx
Screenshot from 2024-04-21 11-03-24

@Dahkahtah Dahkahtah changed the title Function RANDBETWEEN outputs bounding numbers at half of the expected frequency Function RANDBETWEEN outputs bounding numbers at half the frequency of other outputs Apr 21, 2024
@rsnegirev
Copy link

Hi @Dahkahtah

This is really interesting bug, number is 67686.

Thank you for the report!

@Rita-Bubnova Rita-Bubnova added the confirmed-bug Issues with confirmed bugs label Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug Issues with confirmed bugs
Projects
None yet
Development

No branches or pull requests

3 participants