Skip to content

Logger.moon caused RNG seed fixed to 0 #25

@Lambholl

Description

@Lambholl

When I was generating subtitles from script which contains math.random, I found that each time when I started up Aegisub, the random function always gives same results.
Then I found when I added math.randomseed(0) to script, the results are always the same as the first-time-run after startup, so it could be sure that RNG seed was set to 0 each time Aegisub starts up.
So the only one code that affects random seed could be found is in DependencyControl/Logger.moon:

unless seeded
    timer.sleep 10 for i=1,50
    math.randomseed(timer\timeElapsed!*1000000)
    math.random, math.random, math.random
    seeded = true
    -- timer gets freed on garbage collection
    timer = nil

So it could be preferred that timeElapsed always returns a 0 which caused the issue.

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