Skip to content
Snippets Groups Projects
Commit 7b697600 authored by Tibor Auer's avatar Tibor Auer
Browse files

NEW: sequence generation for nback

parent 82388940
No related branches found
No related tags found
No related merge requests found
from numpy.random import permutation, choice, uniform
from numpy import append
def nback(low,high,size,nback,prob):
seq = permutation(range(low,high+1))[0:nback]
for i in range(size):
if uniform(0,1,1)[0] < prob:
seq = append(seq,seq[-nback])
else:
pool = [i for i in range(low,high+1) if all(i != seq[-nback:])]
seq = append(seq,choice(pool,1))
return seq
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment