-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Faster implementation of rand(Range1) #3779
Conversation
+1 |
This is great. As far as I'm concerned you can merge at will. |
Faster implementation of rand(Range1)
ulen = convert(Uint128, length(r)) | ||
convert(Int128, first(r) + randu(ulen)) | ||
end | ||
|
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 wish there were a more compact way to write the above three functions without all the duplication. How about convert these to a macro?
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.
A macro seems like overkill here. Surely there is another way to write it. Maybe randu(unsigned(length(r)))
?
@ViralBShah I think you mis-labeled this |
Thanks. In the labelling spree, this happened a few times and I thought I had fixed all the cases. |
…53220) Replaces #53216 (I can't push to that repo branch) Adds - making pkgimages for REPLExt - Fixes PkgCompletionProvider location Stdlib: Pkg URL: https://github.com/JuliaLang/Pkg.jl.git Stdlib branch: master Julia branch: master Old commit: f3b81f1aa New commit: 6dd0e7c9e Julia version: 1.11.0-DEV Pkg version: 1.11.0 Bump invoked by: @IanButterworth Powered by: [BumpStdlibs.jl](https://github.com/JuliaLang/BumpStdlibs.jl) Diff: JuliaLang/Pkg.jl@f3b81f1...6dd0e7c ``` $ git log --oneline f3b81f1aa..6dd0e7c9e 6dd0e7c9e Revert "add test for recurring precompile" (#3779) dbf114fa9 Merge pull request #3777 from JuliaLang/kc/repl_extension a49d47981 fixup e3edf3917 avoid prompting for git creds on CI (#3778) 510454343 make the `REPL` specific code into an extension 12d2de14e make `pkgstr` independent of REPL ``` --------- Co-authored-by: Dilum Aluthge <dilum@aluthge.com> Co-authored-by: Valentin Churavy <vchuravy@users.noreply.github.com> Co-authored-by: Kristoffer Carlsson <kcarlsson89@gmail.com> Co-authored-by: Jameson Nash <vtjnash@gmail.com>
Faster & simpler implementation of rand(Range1), and it strictly guarantees equal probabilities of choosing each integer within the range.
My benchmark shows that it is about 1.7x - 2.1x faster than the original implementation.