← Docs
kotlin-stdlib / kotlin.random / nextLong

nextLong

Common
JVM
JS
Native
1.3
fun Random . nextLong ( range : LongRange ) : Long
(source)

Gets the next random Long from the random number generator in the specified range .

Generates a Long random value uniformly distributed in the specified range : from range.start inclusive to range.endInclusive inclusive.

Exceptions

IllegalArgumentException - if range is empty.

Stay in touch:
  • Contributing to Kotlin
  • Releases
  • Press Kit
  • Security
  • Blog
  • Issue Tracker
  • Brand assets
  • Careers
Supported and developed by JetBrains .
Kotlin™ is protected under the Kotlin Foundation
and licensed under the Apache 2 license .