Skip to content

Instantly share code, notes, and snippets.

@DAP-DarkneSS
Created July 26, 2011 18:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DAP-DarkneSS/1107388 to your computer and use it in GitHub Desktop.
Save DAP-DarkneSS/1107388 to your computer and use it in GitHub Desktop.
Simple generator of random numbers within the specified interval.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#Указывается язык и кодировка.
#This code is released under
#GNU LESSER GENERAL PUBLIC LICENSE
#http://www.gnu.org/copyleft/lesser.html
from random import uniform
#Загружается модуль случайных чисел.
print 'Simple generator of random numbers within the specified interval.'
print '-----------'
max = input("Enter maximum number: ")
min = input("Enter minimum number: ")
n = input("Enter quantity of numbers: ")
print '-----------'
#Приветствие и ввод данных.
for i in xrange(0,n):
print uniform(min, max)
#n раз вычисляется и выводится случайное число в заданном интервале.
raw_input("Enter to exit...")
#Программа ожидает ввода. Можно скопировать значения.
#Необходимо, если программа запускается не в эмуляторе терминала.
#NB! Называйте программы так, чтобы имя файла не совпадало с названием загружаемых модулей!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment