Re: [go-nuts] Randomizing contents of a file

2016-09-20 Thread Bakul Shah
Not quite what you asked for but rather than use N goroutines, why not slurp in the whole file in a list ([]string) of lines and then output them in random order? Something like for _, i := range deal(len(lines)) { fmt.Println(lines[i]) } Where you'd write deal(n) to return a list of n numbe

Re: [go-nuts] Randomizing contents of a file

2016-09-20 Thread Marvin Renich
* Marvin Renich [160920 08:26]: > As a general rule of thumb, use a select only when you have more than > one channel send and/or receive that you want to wait for, and only use ^ different > a default case when you have other work that can be done if the channel > operations are all blocked

Re: [go-nuts] Randomizing contents of a file

2016-09-20 Thread Marvin Renich
* Unknown User [160920 06:43]: > Hi All, > > I am trying to print the contents of a file randomizing the lines. > The following code works, but does not exit even after all the lines are > read. > What needs to be done to correct it? Try this package mai