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

RandomScoreFunction.PRNG generates weak random numbers #5578

Closed
jpountz opened this issue Mar 27, 2014 · 2 comments
Closed

RandomScoreFunction.PRNG generates weak random numbers #5578

jpountz opened this issue Mar 27, 2014 · 2 comments

Comments

@jpountz
Copy link
Contributor

jpountz commented Mar 27, 2014

Here is some code extracted from PRNG.random(int):

long rand = doc;
rand |= rand << 32;
rand ^= rand;
return nextFloat(rand);

The issue is that rand ^= rand; is equivalent to rand = 0; so in the end, the random score generation completely discards the doc ID that was provided.

@pickypg
Copy link
Member

pickypg commented Mar 28, 2014

Note: this is a dupe of #5454 although this one explains the issue

pickypg added a commit to pickypg/elasticsearch that referenced this issue Mar 31, 2014
uboness pushed a commit that referenced this issue Apr 11, 2014
uboness pushed a commit that referenced this issue Apr 11, 2014
@uboness uboness self-assigned this Apr 28, 2014
@uboness
Copy link
Contributor

uboness commented Apr 28, 2014

closed by e8ea9d7

@uboness uboness closed this as completed Apr 28, 2014
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