bolshaaan
BAN USER
Comments (3)
Reputation 0
Page:
1
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
0
of 0 vote
package fbinterview
import (
"math/rand"
)
// 4 parts
func Rand2() int {
return rand.Intn(2)
}
func Rand3() int {
// generate 6 numbers
var n int
for i := 0; i < 6; i++ {
n = n<<1 | Rand2()
}
switch {
case n < 26:
return 0
case n < 41:
return 1
default:
return 2
}
}
Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
- bolshaaan November 07, 2017