This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import kotlin.math.floor | |
| /** | |
| * This class implement a Linear Congruential Generator. | |
| * | |
| * @author Valentin Michalak | |
| */ | |
| class Random(private var seed: Long = 0) { | |
| companion object { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.* | |
| fun main(args: Array<String>) { | |
| (1..10).forEach { println(spin("my {little|big} pony")) } | |
| } | |
| fun spin(value: String): String { | |
| var result: String = value | |
| val random: Random = Random() | |
| val regex: Regex = Regex("\\{[^{}]*}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.vmichalak.benchmark | |
| import org.openjdk.jmh.annotations.Benchmark | |
| import org.openjdk.jmh.annotations.Scope | |
| import org.openjdk.jmh.annotations.State | |
| val text = """ | |
| Lorem ipsum dolor sit amet, consectetur adipiscing elit. | |
| Nulla pretium ante at commodo gravida. |