-
-
Notifications
You must be signed in to change notification settings - Fork 359
Added rust version of bogo sort #143
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
Conversation
true | ||
} | ||
|
||
fn bogo_sort(arr : &mut Vec<i32>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should take a &mut [i32]
instead since you don't need any of the Vec
functionality.
} | ||
|
||
fn main() { | ||
let mut v = vec!(1,2,3,4,5); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think most everyone uses let mut v = vec![1, 2, 3, 4, 5]
instead of the regular parens. Also make sure to have spaces after the commas to conform to the style guide (or you can just run rustfmt
)
|
||
extern crate rand; | ||
|
||
fn shuffle(arr : &mut Vec<i32>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rand
already has a shuffle function, just use that and delete this one
You were faster the slice changes than I was with the review :) Edit: sorry, accidentally pushed the wrong button, didn't mean to close the PR |
|
||
extern crate rand; | ||
|
||
fn shuffle(arr : &mut [i32]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You still don't really need this function, just use the one that rand
provides.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the changes, looks good to me. I'll wait a bit with the merge in case anyone else wants to comment
@Gustorn Pretty sure you're the only active contributor who knows Rust well enough. |
Fair enough |
No description provided.