Commit Graph

13 Commits

Author SHA1 Message Date
Alexander Shabalin fa9c620261 [K/N] Migrate some runtime/basic tests to new testing infra ^KT-61259 2023-11-10 15:51:05 +00:00
Ilya Gorbunov 193effc7c4 Fix Random.nextLong returning value out of range KT-47304
Correctly zero-extend the lower Int part of the Long being produced
2021-09-29 06:50:41 +00:00
Svyatoslav Scherbina 0f4173cdfa Fix running stdlib tests in worker on Native
Add `@SharedImmutable` or `@ThreadLocal` where required.
2020-12-14 19:03:06 +03:00
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
Ilya Gorbunov ed1f869354 Add xorwow random implementation test and fix implementation 2018-08-30 14:50:46 +03:00