I'm on an official build of 0.6.2, and it doesn't seem to be available.
rand(IntSet(1:10))
throws "ERROR: MethodError: no method matching rand(::IntSet)"
Seems like IntSet is just a wrapper over a bitfield of true/false values? Not sure what a fast O(1) would look like for that, but it would be nice to have available!
Hey,
I would like to work on this, if it can wait until Friday or the weekend. I'm not sure it can be really done in O(1), but I can do better than rand(collect(.))
.
Incidentally, in my context, I actually need to sample from both the true and false values. When you figure out how to do this for the usual scenario of sampling from the true values, I would appreciate if you could comment on how to modify that for sampling from the false values if you have time. Thanks!
So I played around with this and have an implementation for 0.6 ready, but I realized rand(::IntSet)
is already defined on master.
If that is desired, I can add it as a fix for the next release of Julia v0.6, but I need some guidance on how to make a pull request for an old version.
Either way, @jsams, you can send me an email (so we don't spam this issue) and I can send you the code, or help you come up with something more efficient for your specific use case.
So then this issue can be considered fixed by dd6a94ab21dac82b2157730bbf3399f499050fc7 (#25029).
I can add it as a fix for the next release of Julia v0.6, but I need some guidance on how to make a pull request for an old version.
v0.6
are not getting any more features, besides, it is unlikely that there will be another release in the 0.6 series.
Most helpful comment
Hey,
I would like to work on this, if it can wait until Friday or the weekend. I'm not sure it can be really done in O(1), but I can do better than
rand(collect(.))
.