Every line of 'random function in python' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
46 def mutate(code_l: iter, func: callable, rate: float): 47 for code in code_l: 48 if rate < random(): 49 continue 50 index = randint(0, len(code) - 1) 51 code[index] = func(index)
38 def f(_): 39 x = random() * 2 - 1 40 y = random() * 2 - 1 41 return 1 if x ** 2 + y ** 2 < 1 else 0
33 def gen_random(): 34 return random.random()
14 def random(size): 15 return rand(*size)
46 def get_random(nbytes): 47 random_hex = binascii.hexlify(os.urandom(nbytes)) 48 return hex_to_long(random_hex)
15 def rando(): 16 return random.StrongRandom().randint(2, 20000000)