News for hackers. Stuff that matters.
Re:Go 1.11 Beta 1 is released by pquerna on Wednesday June 27, 2018 @01:29AM (#17405986)
I thought an "interesting" part of the change was actually how they made a 50% chance work for the extra read. They select across a closed channel twice -- and it results in a mostly even distribution of chance.

    for i := 0; i < 100000; i++ {
        select {
        case <-closedChan:
            a++
        case <-closedChan:
            b++
        case <-closedChan:
            c++
        case <-closedChan:
            d++
        }
    }
Results in an almost even distribution across the select choices!

https://play.golang.org/p/cnAXBEZJm2B

(fixed playground link)

Re:Go 1.11 Beta 1 is released by zimpenfish on Wednesday June 27, 2018 @01:38AM (#17406007)
You're printing `b` three times in that Playground which makes it a look skewed.

    a: 25100
    b: 25080
    c: 25080
    d: 25080
vs

    a: 24973
    b: 25010
    c: 25013
    d: 25004
Re:Go 1.11 Beta 1 is released by cup-of-tea on Wednesday June 27, 2018 @02:57AM (#17406253)
So it's deterministic. I got the same numbers.
Re:Go 1.11 Beta 1 is released by akavel on Wednesday June 27, 2018 @03:23AM (#17406340)
On the Playground or on your PC? The Playground has an execution cache, so the same input code always gives the same (thus "deterministic") result.
Re:Go 1.11 Beta 1 is released by cup-of-tea on Wednesday June 27, 2018 @05:11AM (#17406766)
Ah OK, it was on the playground. Is it deterministic when not cached?
Re:Go 1.11 Beta 1 is released by dosshell on Wednesday June 27, 2018 @05:21AM (#17406804)
It is not deterministic on playground if it is not cached.

You can add dummy code to the file to break free from the cache.

Re:Go 1.11 Beta 1 is released by rejschaap on Wednesday June 27, 2018 @05:46AM (#17406903)
Adding some white space also does the trick