Skip to content

Using global rand functions can have bad results if the user attempts to use seed(...) #238

@Lexari0

Description

@Lexari0

NetworkWeapon._generate_id(...) calls randi_range(...) for selecting random characters. This would normally be fine, but if a user attempts to use seed(...) to intentionally generate the same random values all peers it'll end up re-using the same values.

Using a RandomNumberGenerator (initialized with randomize()) to always maintain a seed unique from others' code and expectations is recommended (also for the user, so this is half on me 😉).

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