File: random.py

package info (click to toggle)
python-orbit 0.3.1-12
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,492 kB
  • ctags: 801
  • sloc: sh: 9,444; ansic: 5,642; python: 1,141; makefile: 126
file content (17 lines) | stat: -rwxr-xr-x 435 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env python

import urllib
import CORBA
from _GlobalIDL import Random

orb = CORBA.ORB_init()
print "Fetching IOR from random.org, hang on ..."
ior = urllib.urlopen("http://www.random.org/Random.ior").readline()
o = orb.string_to_object(ior)

try:
	print "Here are 5 random numbers:"
	for i in range(5):
		print o.lrand48()
except CORBA.COMM_FAILURE:
	print "Couldn't connect to random.org CORBA server.  Perhaps it's down?"