giordano / RandomBasedArrays.jl

Hassle-free arrays: the first index is always random
MIT License
17 stars 0 forks source link

Should say "random sampling from an array" #6

Open bootchk opened 3 years ago

bootchk commented 3 years ago

First, thanks, I enjoyed reading the code and the humor here.

I think the code is a good tutorial in random sampling from an array. I needed the one line of code that gets a random index on the parent. (It also seems a good tutorial how to define methods on a new type.)

Is it really "random based" or should you say "every based" or "not based" or "always shuffled?" A strange beast indeed.

giordano commented 3 years ago

Thanks for the nice comments 🙂

Yes, I agree that "random-based indexing" is a bit misleading: in practice every time you access an element of the wrapper array, you get a random element of the wrapped array, it isn't like you "start" from a random index, otherwise you'd like get out-of-bounds very frequently.

However I'm not really sure how to call it, your "always shuffled" is probably a more accurate description, but honestly the point of this package is that indexing shouldn't be taken too seriously, I'm quite fed up by the 0- vs 1-based indexing holy war 😉