next
Thanks for your feedback!
Was this page helpful?
Gets the next random Boolean value.
import kotlin.math.sin import kotlin.random.Random import kotlin.test.assertTrue fun main() { //sampleStart val presents = listOf("Candy", "Balloon", "Ball") // a random partition, the result may be different every time val (alicePresents, bobPresents) = presents.partition { Random.nextBoolean() } println("Alice receives $alicePresents") println("Bob receives $bobPresents") //sampleEnd }
xxxxxxxxxx
val presents = listOf("Candy", "Balloon", "Ball")
// a random partition, the result may be different every time
val (alicePresents, bobPresents) = presents.partition { Random.nextBoolean() }
println("Alice receives $alicePresents")
println("Bob receives $bobPresents")
Thanks for your feedback!