Commit Graph

9 Commits

Author SHA1 Message Date
nikita.movshin 65244b4bea Update copyright.
Change the copyright from "JetBrains s.r.o." to
"JetBrains s.r.o. and Kotlin Project contributors"
Update only 2 lines copyright.
2019-04-23 20:09:22 +03:00
Sergey Bogolepov 2f1f32bbf4 Replace random val in companion object with top level val 2018-10-10 19:04:55 +03:00
Ilya Gorbunov 928fe19801 Rename Random.next* parameters: remaining renames
- Correct docs after parameter renaming
- Rename parameters in Random inheritors
- Rename local variables

#KT-26596
2018-09-14 15:15:52 +03:00
kenji tomita ffb83bbdf0 Rename Random.next* parameters from "origin, bound" to "from, until"
Rename Random test methods

#KT-26596
2018-09-14 15:15:52 +03:00
Ilya Gorbunov 9c412ba436 Fix incorrect range transform in nextUInt/nextULong with range parameter
#KT-25570
2018-08-30 16:21:33 +03:00
Ilya Gorbunov 9c4a74ce5b Improve stability of nextBoolean test
Increase number of tosses (according to the Law of Large Numbers).
2018-08-30 16:21:05 +03:00
Ilya Gorbunov d035c2690a Random extensions for unsigned: fixes after review
#KT-25570
2018-08-30 16:21:01 +03:00
Kerooker f9dec5e794 Implement extension functions for Random: nextUInt, nextULong and nextUBytes
Given there's a Random API in the stdlib, that generates all random primitives, this commit adds the possibility to generate random unsigned integers.
It uses the same implementation from Random.nextInt, nextLong and nextBytes, but uses the appropriate conversions from a signed type to an unsigned type.

The use of the same API guarantees that the distribution is uniform, but this commit adds some unit test to enforce that necessity.

Fixes #KT-25570
2018-08-30 16:20:58 +03:00
Ilya Gorbunov b96803248f Write random contract tests and fix implementations to pass them 2018-08-30 14:50:48 +03:00