def copy_stream(length, low=2, high=15, n=1):
  """Generate `n` random sequences of length `length` and yield with copies."""
  while True:
    res = []
    for _ in range(n):
      seq = np.random.randint(low, high, size=(length,), dtype=np.int32)
      res.extend([seq, seq])
    yield res
Generate `n` random sequences of length `length` and yield with copies.
trax/rl/envs/data_envs.py