Beispiel #1
0
def randquantum(length):
    '''Induce INDEPENDENCE by HYBRID between authentic and pseudo.
    The sources are clearly independent. This method also stochastically 
    disrupts the deterministic periodicity of pseudo generation.
    SPEED: by incorporating pseudo, we fetch fewer times from the server.

    We set aside an authentic list from which we will draw upon 
    with prob(authentic), otherwise we call upon some pseudo number, 
    and thus we grow the hybrid list to desired length.
    '''
    #            AUTH at the top sets prob(authentic).
    aulen = int(AUTH * length)
    safe = randquantum_safe(aulen)
    #       ^authentic with fallback provision, which means hybrid
    #       could be all pseudo if authentic fails entirely.
    authinverse = int(1 / AUTH)
    hybrid = []
    i = aulen - 1
    while len(hybrid) < length:
        if pseudorange(0, authinverse):
            #              ^stochastically mixes authentic with pseudo.
            hybrid.append(pseudorange(0, 65536))
        else:
            #  Pick element from tailend of safe in reverse order.
            if i >= 0:
                hybrid.append(safe[i])
                i -= 1
    return hybrid[:length]
Beispiel #2
0
def randquantum( length ):
    '''Induce INDEPENDENCE by HYBRID between authentic and pseudo.
    The sources are clearly independent. This method also stochastically 
    disrupts the deterministic periodicity of pseudo generation.
    SPEED: by incorporating pseudo, we fetch fewer times from the server.

    We set aside an authentic list from which we will draw upon 
    with prob(authentic), otherwise we call upon some pseudo number, 
    and thus we grow the hybrid list to desired length.
    '''
    #            AUTH at the top sets prob(authentic).
    aulen = int( AUTH * length )
    safe  = randquantum_safe( aulen )  
    #       ^authentic with fallback provision, which means hybrid 
    #       could be all pseudo if authentic fails entirely.
    authinverse = int( 1 / AUTH )
    hybrid = []
    i = aulen - 1
    while len(hybrid) < length:
        if pseudorange( 0, authinverse ):
            #              ^stochastically mixes authentic with pseudo.
            hybrid.append( pseudorange(0, 65536) )
        else:
            #  Pick element from tailend of safe in reverse order.
            if i >= 0:
                hybrid.append( safe[i] )
                i -= 1
    return hybrid[:length]
Beispiel #3
0
def randquantum_pseudo(length):
    '''Pseudo simulation of randquantum_authentic(), intended as fallback.
    Offline call to the standard Python package random.
    '''
    return [pseudorange(0, 65536) for i in range(length)]
Beispiel #4
0
def randquantum_pseudo( length ): 
    '''Pseudo simulation of randquantum_authentic(), intended as fallback.
    Offline call to the standard Python package random.
    '''
    return [ pseudorange(0, 65536) for i in range(length) ]