Search

Dark theme | Light theme
Showing posts with label KotlinKandy:Collectins. Show all posts
Showing posts with label KotlinKandy:Collectins. Show all posts

April 3, 2026

Kotlin Kandy: Get A Random Element From A Collection

Kotlin has very useful extensions functions for working with collections. These extension functions make working with collections more easy and fun. One of the extension functions is the random function. When you call random() Kotlin returns a single element from the collection using the default random source. The function also accepts a Random instance as argument. This instance has a seeded value to return repeatable random values.