使用 lambda 的运算符

如果你有:

val r = Random(233)
infix inline operator fun Int.rem(block: () -> Unit) {
  if (r.nextInt(100) < this) block()
}

你可以编写以下类似 DSL 的代码:

20 % { println("The possibility you see this message is 20%") }