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

Issue with RANDOMARRAY #1379

Open
skai111 opened this issue Dec 8, 2024 · 2 comments
Open

Issue with RANDOMARRAY #1379

skai111 opened this issue Dec 8, 2024 · 2 comments
Labels
bug Something isn't working duplicate This issue or pull request already exists user Reported by an actual user, yay!

Comments

@skai111
Copy link

skai111 commented Dec 8, 2024

DB50X v.0.8.7 Hardware DM42n
RANDOMARRAY does not generate uniformly distributed values.

According to help file, RANDOMARRAY returns an array with containing random integer values between -9 and 9.
I would therefore expect all integers within this interval to be uniformly generated.
However, end points (-9, 9) are only generated with half the probability, and 0 is generated with twice the probability.
In my opinion this is rather unexpected, and behavior should be changed, or at least carefully explained in the help file.
Strangely enough, the HP50G seems to generate 0 with twice the uniform probability, I've never noticed this before.

@c3d c3d added bug Something isn't working user Reported by an actual user, yay! labels Dec 9, 2024
@c3d
Copy link
Owner

c3d commented Dec 9, 2024

I had actually tried to improve the distribution in some earlier release. It is surprisingly difficult to do right for integers, and the range -9 .. 9 is particularly annoying when coming from a decimal random number. As you pointed out, even HP does not get it right.

@c3d c3d added the duplicate This issue or pull request already exists label Dec 9, 2024
@c3d
Copy link
Owner

c3d commented Dec 9, 2024

This is really a duplicate of #1378

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists user Reported by an actual user, yay!
Projects
None yet
Development

No branches or pull requests

2 participants