Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix rand_in_circle uniformity. #2425

Closed
Closed
@Rapen765

Description

@Rapen765

Enhancement request:

The rand_in_circle function defined in math.py makes more points near the circles's center.

What should be added/changed?

Modify the code code calculating radius r:

# random radiusr=radius*random.random()

to this:

# random radiusr=radius*math.sqrt(random.random())

The square root of a random number ensures the correct density ( based onhttps://stackoverflow.com/a/50746409 ).

What would it help with?

This change would improve the distribution of points for games that rely on this function, such as when spawning entities within a circle. A more uniform spread can enhance gameplay balance by avoiding the clustering of entities near the center.

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


      [8]ページ先頭

      ©2009-2025 Movatter.jp