type Swapper interface { // Swap swaps the elements i and j. Swap(i, j int) }
func Shuffle(s Swapper) On Mon, 2018-10-15 at 19:58 -0700, Bakul Shah wrote: > On Mon, 15 Oct 2018 20:39:11 -0600 andrey mirtchovski <mirtchovski@gm > ail.com> wrote: > > > > > > > > May be it ought to be called FYShuffle? > > then we'ld have to rename it if we switched the algorithm (which > > has > > happened once for sort.Sort already). that's not what go is about > > :) > Unlikely :-) > > The following is much less obscure. > > func Shuffle(slice inteface{}) > > & might have more more sense. e.g. > > var cards []card > ... > rand.Shuffle(cards) > > > The current Shuffle is confusing. May be because it has a > somewhat clumsy interface. > > > > > maybe you're advocating for implementing a Shuffle interface, which > > brings us round about to where we are right now :) > I'll shuffle off now.... -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.