Created
May 1, 2014 11:25
-
-
Save samstarling/1044d3d50b3d7a69e969 to your computer and use it in GitHub Desktop.
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.distributed | |
object Helpers { | |
def maybe(chance: Double)(success: => Any)(failure: => Any) = { | |
if(scala.util.Random.nextFloat() < chance) { | |
success | |
} else { | |
failure | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment