/
ilya.petrash
/
SimplePyScripts
Обзор
Документация
Войти
/
ilya.petrash
/
SimplePyScripts
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
0.0.0
Random_example/main.py
19 строк
720 B
Ilya Petrash
#
17 ноя 2016, 20:38
17 ноя 2016, 20:38
411107a
Код
Авторство
О чём код?
__author__ = 'ipetrash' import random if __name__ == '__main__': direction = ["up", 'down', 'left', 'right'] for i in range(5): print("Directions: %s, random direction = %s" % (direction, random.choice(direction))) print("random: %s" % random.random()) # rand float number print("randrange(5): %s" % random.randrange(5)) # rand int number print("randrange(0, 10): %s" % random.randrange(0, 10)) # rand int number print("uniform(1, 10): %s" % random.uniform(1, 10)) # rand float number print("Directions: %s" % direction) random.shuffle(direction) # shuffle list print("Shuffle directions: %s" % direction) print(random.sample(direction, 2)) # select two element