<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def endless_permutations(N, random_state=None):
 """ Generate an endless sequence of random integers from permutations of the If we call this N times, we will sweep through the entire set without replacement, on the (N+1)th call a new permutation will be created, etc. Parameters N: int the length of the set random_state: int or RandomState, optional random seed Yields ------ int: """

    generator = check_random_state(random_state)
    while True:
        batch_inds = generator.permutation(N)
        for b in batch_inds:
            yield b