rasa/core/utils.py
def subsample_array(arr: List[Any],
                    max_values: int,
                    can_modify_incoming_array: bool = True,
                    rand: Optional['Random'] = None) -> List[Any]:
    """Shuffles the array and returns `max_values` number of elements."""
    import random

    if not can_modify_incoming_array:
        arr = arr[:]
    if rand is not None:
        rand.shuffle(arr)
    else:
        random.shuffle(arr)
    return arr[:max_values]
Shuffles the array and returns `max_values` number of elements.
Shuffles the array and returns `max_values` number of elements.
Shuffles the array and returns ` max_values ` number of elements .
def subsample_array(arr: List[Any],
                    max_values: int,
                    can_modify_incoming_array: bool = True,
                    rand: Optional['Random'] = None) -> List[Any]:
    import random
    if not can_modify_incoming_array:
        arr = arr[:]
    if rand is not None:
        rand.shuffle(arr)
    else:
        random.shuffle(arr)
    return arr[:max_values]
def subsample_array ( arr : List [ Any ] , max_values : int , can_modify_incoming_array : bool = True , rand : Optional [ 'Random' ] = None ) -> List [ Any ] : import random if not can_modify_incoming_array : arr = arr [ : ] if rand is not None : rand . shuffle ( arr ) else : random . shuffle ( arr ) return arr [ : max_values ]
Shuffles the array and returns `max_values` number of elements.
Shuffles the array and returns ` max_values ` number of elements .
"""Shuffles the array and returns `max_values` number of elements."""
arr
List[Any]
max_values
int
can_modify_incoming_array
bool
rand
Optional['Random']