Skip to content

Bias to smaller numbers #752

@AlexRFox

Description

@AlexRFox

I'm not sure if this is intentional or not, so I'm not sure if this should be documented or fixed. I believe this function creates a bias to smaller numbers, because it has a 1/9 chance to pick lengths from 1 to 9 inclusively, then it generates a random number from 0 to 10^(randomly picked size). So there's a 1/9 chance it'll pick a length of 1, then a 1/10 chance it'll pick a 0, leading to a 1/90 chance to pick 0 in a range that goes from 0 to 10^9.

public long randomNumber() {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions