-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check elements are distinct in simple lottery. (#111)
## Content Found another issue with the simple lottery. We need to check that elements in the proof are distinct. I guess the simple lottery is not so simple. :) ## Pre-submit checklist - Branch - [x] Tests are provided (if possible) - [x] Commit sequence broadly makes sense - [x] Key commits have useful messages - PR - [x] No clippy warnings in the CI - [x] Self-reviewed the diff - [x] Useful pull request description - [x] Reviewer requested - Documentation - [x] Update README file (if relevant) - [x] Update documentation website (if relevant)
- Loading branch information
1 parent
727bd6b
commit 94c7624
Showing
4 changed files
with
16 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
use super::types::Element; | ||
|
||
/// Returns true iff all elements in the slice are distinct. | ||
pub(crate) fn check_distinct(elements: &[Element]) -> bool { | ||
let mut elements = elements.to_vec(); | ||
elements.sort_unstable(); | ||
elements.is_sorted_by(|a, b| a < b) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
pub(crate) mod sample; | ||
|
||
pub(crate) mod types; | ||
|
||
pub(crate) mod misc; |