On Friday, June 24, 2016 at 1:16:12 PM UTC-4, Joubin Houshyar wrote: > > > On Friday, June 24, 2016 at 7:39:23 AM UTC-4, Konstantin Khomoutov wrote: >> >> On Fri, 24 Jun 2016 04:05:49 -0700 (PDT) >> dc0d <kaveh.sh...@gmail.com> wrote: >> >> > To shuffle items in a slice I'm doing this: >> > >> > var res []Item >> > >> > //fill res logic >> > >> > shuffle := make(map[int]*Item) >> > for k, v := range res { >> > shuffle[k] = &v >> > } >> > res = nil >> > for _, v := range shuffle { >> > res = append(res, *v) >> > } >> > >> > Which inserts items into a map then ranges over that map. Ranging >> > over a map in Go returns the items in random order. >> > >> > 1 - I thought it's a cool trick! >> > 2 - Is anything bad about doing this? >> >> What's wrong with a standard approach [1]? >> >> 1. >> https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm >> >> > > > Thanks for the link. I've been experimenting with quadratic residue mod p > (in N, counting numbers, so no zero) based scrambler for the final stage > of a hash. P values in 17, 257, 4097, and 66537 map quite nicely to some of > the more usual mem-obj sizes. >
s/66537/65537 -- 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.