Re: [go-nuts] Behaviour manifested by select statement

2016-12-29 Thread Abhishek Singh
Thanks Caleb, this is looks more idiomatic Go. > On 29-Dec-2016, at 17:14, Caleb Doxsey wrote: > > Use time.After: > > package main > > import ( > "log" > "math/rand" > "time" > ) > > func randomSleep(min, max int64) <-chan time.Time { > rand.Seed(time.

[go-nuts] Behaviour manifested by select statement

2016-12-28 Thread Abhishek Singh
Hi, Below is a sample example, where I'm trying to understand behaviour of select statement. I was hoping the time.After() case clause to succeed but observation is that either of those clauses are executed intermittently. Would help if someone could share what's going on. func randomSleep(min