Last active
February 19, 2018 02:41
-
-
Save WhisperingChaos/43a1091ce65512c15472b1441035acea to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func consumeOrderedByAffectingProbability(msg_1ch chan msg_1, msg_2ch chan msg_2) { | |
// implement priorty function that selects messages from msg_2ch twice as often | |
// as msg_1ch by affecting the probability function of the select | |
// statement. produces outcome whose message type totals are equivalent to | |
// nil bias function but using simpler encoding. | |
for msgCnt := 0; msgCnt < 21; msgCnt++ { | |
select { | |
case msg, ok := <-msg_1ch: | |
if ok { | |
msg.msgType() | |
} | |
case msg, ok := <-msg_2ch: | |
if ok { | |
msg.msgType() | |
} | |
case msg, ok := <-msg_2ch: | |
if ok { | |
msg.msgType() | |
} | |
} | |
} | |
} | |
Ordered By Affecting Select Probability Run 1 Ordered By Affecting Select Probability Run 2 | |
msg type 1 msg type 2 | |
msg type 2 msg type 2 | |
msg type 1 msg type 2 | |
msg type 2 msg type 1 | |
msg type 2 msg type 2 | |
msg type 2 msg type 2 | |
msg type 1 msg type 2 | |
msg type 2 msg type 1 | |
msg type 2 msg type 2 | |
msg type 2 msg type 2 | |
msg type 2 msg type 2 | |
msg type 2 msg type 1 | |
msg type 2 msg type 2 | |
msg type 2 msg type 2 | |
msg type 2 msg type 2 | |
msg type 1 msg type 1 | |
msg type 1 msg type 2 | |
msg type 2 msg type 2 | |
msg type 1 msg type 2 | |
msg type 2 msg type 2 | |
msg type 1 msg type 2 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment