randomMRP.py
def next_state_prob(num_states):
    """
        Generate the next-state probability by random partitions of the unit interval.

        Input:
                num_states: number of next states

        Output:
                prob: a vector of next-state probabilities.
    """

    rvs = np.random.uniform(0, 1, num_states - 1)
    rvs.sort()
    prob = np.zeros(num_states)

    for s in range(num_states):
        if s == 0:
            prob[s] = rvs[0] - 0.0
        elif s == num_states - 1:
            prob[s] = 1.0 - rvs[-1]
        else:
            prob[s] = rvs[s] - rvs[s - 1]

    return prob

        Generate the next-state probability by random partitions of the unit interval.

        Input:
                num_states: number of next states

        Output:
                prob: a vector of next-state probabilities.
    
Generate the next-state probability by random partitions of the unit interval.
Input:
num_states: number of next states

a vector of next-state probabilities.
Generate the next - state probability by random partitions of the unit interval . Input : num_states : number of next states a vector of next - state probabilities .
def next_state_prob(num_states):
    rvs = np.random.uniform(0, 1, num_states - 1)
    rvs.sort()
    prob = np.zeros(num_states)
    for s in range(num_states):
        if s == 0:
            prob[s] = rvs[0] - 0.0
        elif s == num_states - 1:
            prob[s] = 1.0 - rvs[-1]
        else:
            prob[s] = rvs[s] - rvs[s - 1]
    return prob
def next_state_prob ( num_states ) : rvs = np . random . uniform ( 0 , 1 , num_states - 1 ) rvs . sort ( ) prob = np . zeros ( num_states ) for s in range ( num_states ) : if s == 0 : prob [ s ] = rvs [ 0 ] - 0.0 elif s == num_states - 1 : prob [ s ] = 1.0 - rvs [ - 1 ] else : prob [ s ] = rvs [ s ] - rvs [ s - 1 ] return prob
Generate the next-state probability by random partitions of the unit interval.
Generate the next - state probability by random partitions of the unit interval .
"""
        Generate the next-state probability by random partitions of the unit interval.

        Input:
                num_states: number of next states

        Output:
                prob: a vector of next-state probabilities.
    """
num_states