Beispiel #1
0
# Test the seedfinder
# Should probably be threaded and whatnot, but i dont have time right now. Dammit. 
import random # :3
from seedfind import Seedfinder
from avrlibcrandom import random as avrrand
from avrlibcrandom import srandom as avrsrand
from time import time
from sys import argv, exit

if len(argv) < 2:
    print "python", argv[0], "k"
    exit(1)

random.seed() # uses system time
sf = Seedfinder() # use default sample source
samples = open("samples.txt", "r").read().split('\n')

sendValues = 100

# Iterations
k = int(argv[1])
# How many values can we skip at the most before we send in the sequence? Max depth
l = 1000
# How well do we want to estimate C?
est = 0.8

meant = []

giveups = 0

for i in range(k):
Beispiel #2
0
#coding: utf-8

from stattests import StatTests, FipsTests
from seedfind import Seedfinder
from avrlibcrandom import random, srandom

f = open('samples.txt').read().split('\n')

seed = int(f[0])

seed = 526

srandom(seed) 
seq = [random() for _ in range(1000)][990:]

print "Ég sendi inn þessa runu", seq

s = Seedfinder()
print "Ég fann", s.findseed(seq, 0), "en þú gafst mér", seed

Beispiel #3
0
#coding: utf-8

from stattests import StatTests, FipsTests
from seedfind import Seedfinder
from avrlibcrandom import random, srandom

f = open('samples.txt').read().split('\n')

seed = int(f[0])

seed = 526

srandom(seed)
seq = [random() for _ in range(1000)][990:]

print "Ég sendi inn þessa runu", seq

s = Seedfinder()
print "Ég fann", s.findseed(seq, 0), "en þú gafst mér", seed