#!/usr/bin/env python import random import time import math import sys def getData(): arg = './food.txt' try: f = open(arg, 'r') except IOError as e: print("\n") print 'Yoyoyo, Food File can not be found', arg print 'Please place the food text file on the same location as this python file.' print "Exiting..." sys.exit() temp = [] for i in f: temp.append(i) f.close() return temp def findLocation(rest): temp="" # http://www.random.org/decimal-fractions/?num=1&dec=20&col=1&format=html&rnd=new # i wish there is a better way to randomize numerical values in all programming # languages when calling the random() function. There is always random.org size=len(rest) a = 0 while a < 10: random.seed(time.time()*random.gauss(random.random()*math.sqrt(math.pi),time.time()*math.pi)) a=a+1 temp = rest[random.randint(0,size-1)] return temp def printLocation(cow): print("\n") print("Your restaurant of randomness is: " + cow) def main(): a = getData() b = findLocation(a) printLocation(b) main()