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

non-uniformity in random ship position #1

Open
bennetyee opened this issue Jan 23, 2019 · 0 comments
Open

non-uniformity in random ship position #1

bennetyee opened this issue Jan 23, 2019 · 0 comments

Comments

@bennetyee
Copy link
Member

let first: i8 = rng.gen_range(0, board_size - ship_length + 1);

first is chosen to be in [0, board_size - ship_length] ignoring orientation -- later we appear to be doing rejection sampling in L101-L104 based on orientation. however, at L111 when orientation is false (horizontal, if first coordinate is row and second coordinate is column) we use (first, second + tile), which means that we will never see a randomly placed ship in the last ship_length rows in an horizontal orientation.

not a framework security bug.

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

No branches or pull requests

1 participant