Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Fix Issue 20550 - Use fixed seeds for treaps in GC #2919

Merged
merged 1 commit into from
Feb 6, 2020

Conversation

n8sh
Copy link
Member

@n8sh n8sh commented Jan 31, 2020

Discussion started from ldc-developers#168.

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @n8sh!

Bugzilla references

Auto-close Bugzilla Severity Description
20550 enhancement Use fixed seeds for treaps in GC

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub fetch digger
dub run digger -- build "master + druntime#2919"

@dlang-bot dlang-bot added the Enhancement New functionality label Jan 31, 2020
@thewilsonator thewilsonator added the 72h no objection -> merge The PR will be merged if there are no objections raised. label Jan 31, 2020
{
rand48.defaultSeed();
Rand48 _rand48 = { randSeed };
rand48 = _rand48;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't rand48 = Rand48(randSeed); work here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no it doesn't because of the opCall override

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok (though it seems a hole in @safe if you are allowed to initialize any private members of a struct like this.) I'm not sure why the compiler tries to invoke a non-static opCall. Adding this(ulong) to Rand48 allows to use the constructor syntax.

@@ -27,9 +27,10 @@ nothrow:
removeAll();
}

void initialize()
void initialize(ulong randSeed)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be a problem to keep the existing initialize() method, but also allow passing the seed explicitly in an overload? I'm not expecting Treap to be used often, but having to come up with a magic number can be annoying.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe define rand() as the default parameter value?

@thewilsonator thewilsonator added auto-merge and removed 72h no objection -> merge The PR will be merged if there are no objections raised. labels Feb 6, 2020
@dlang-bot dlang-bot merged commit 0f9cd78 into dlang:master Feb 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Enhancement New functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants