Last active
August 29, 2015 14:14
-
-
Save Khrol/015d52d2de73ba07d483 to your computer and use it in GitHub Desktop.
This file contains 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
from random import randint | |
from math import copysign | |
def generate(exception, n): | |
x = randint(1, n - 1) | |
if x >= exception: | |
return x + 1 | |
return x | |
def generate_math(exception, n): | |
x = randint(1, n - 1) | |
return int(x + (copysign(1, x - exception) + 1) / 2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment