https://github.com/erictsangx/kotlin-random
https://github.com/erictsangx/kotlin-random
kotlin random testing
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/erictsangx/kotlin-random
- Owner: erictsangx
- License: apache-2.0
- Created: 2016-08-22T05:10:30.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2017-03-24T09:33:50.000Z (over 9 years ago)
- Last Synced: 2025-01-24T22:11:59.957Z (over 1 year ago)
- Topics: kotlin, random, testing
- Language: Kotlin
- Size: 58.6 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# kotlin-random
A very simple lib of Java Random and Kotlin aims to make testing easier, no magic.
Also support Java8 OffsetTime, OffsetDateTime and Instant
## Gradle
```gradle
compile "io.github.erictsangx:kotlin-random:0.0.1"
```
## Maven
```maven
io.github.erictsangx
kotlin-random
0.0.1
```
## Examples:
```kotlin
val a = Rand.int // 1-100 by default
val b = Rand.str // 3feffb92c82745a3b6ccd5f9fec5e3f1
val c = Rand.bool // same as Random().nextBoolean()
val timeA = Rand.time // 15:52:23.130+08:00
val dataA = Rand.nDate //[OffsetDateTime.now] - [1,7] days - [Rand.time]
val dataB = Rand.pDate //[OffsetDateTime.now] + [1,7] days + [Rand.time]
```
## Extensions
```kotlin
class Foo(name: String, age: Int)
val Rand.foo: Foo
get() = Foo(str, int)
```