Skip to content

Check distribution of arcade.math.rand_* functions #2428

Open
@pushfoo

Description

@pushfoo

Enhancement request:

TL;DR: Check for more random call centering bias like that of #2425

What needs verification

In #2426, a call to math.sqrt to wrap the random call seems to fix an issue with center-clustering bias in rand_in_circle. It seems reasonable to check for & fix any similar bias in:

  • arcade.math.rand_on_circle
  • arcade.math.rand_in_rect
  • arcade.math.rand_on_line
  • arcade.math.rand_angle_360_deg
  • arcade.math.rand_angle_spread_deg
  • arcade.math.rand_spread_deg
  • arcade.math.rand_magnitude
  • Any upstream equivalents in the pyglet codebase? no use of random() seems to exist on dev branch outside tests

What would it help with?

Evenness of randomized points.

Best approach?

I'm open to suggestions on this. These seem like hot code paths so I'm uncertain of OOP-y abstractions / indirection layers to customize which distribution function we're mapping into. Thoughts welcome.

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