Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Demo has a super high probability of matching the same pilot against themselves #394

Open
Snafulator opened this issue Jul 7, 2021 · 3 comments

Comments

@Snafulator
Copy link
Contributor

As the title says. If you watch the demo enough you will notice that >50% of the time the pilot will be matched up against themselves.

We might need to look into an alternate random number generator for seeding the pilot_id/har_id.

Not a big deal this one obviously but having an alternate rand_int method somewhere would be a major improvement and i could re-use it in the AI logic too.

@katajakasa
Copy link
Member

Having a better random generator is probably a good idea. Only point is that the generator must be seedable and produce consistent results on different machines when using matching seeds (for network support).

@turol
Copy link

turol commented Aug 16, 2021

The problem is probably because on insufficiently random low-order bits in the generator and a bad algorithm for range reduction.

I suggest PCG as a generator. It's small, fast and has good randomness.

For range reduction check out https://www.pcg-random.org/posts/bounded-rands.html. TL;DR: there's a bunch of ways of doing it, most of them wrong in some way. Pick one of the ready-made unbiased ones to avoid strange issues like this.

@katajakasa
Copy link
Member

Huh, didn't know about PCG, seems good to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants