(expr, condition=None, numsamples=S.Infinity, **kwargs)
Returns an iterator of realizations from the expression given a condition

    expr: Random expression to be realized
    condition: A conditional expression (optional)
    numsamples: Length of the iterator (defaults to infinity)

    Examples
    ========

    >>> from sympy.stats import Normal, sample_iter
    >>> X = Normal('X', 0, 1)
    >>> expr = X*X + 3
    >>> iterator = sample_iter(expr, numsamples=3)
    >>> list(iterator) # doctest: +SKIP
    [12, 4, 7]

    See Also
    ========
    Sample
    sampling_P
    sampling_E
    sample_iter_lambdify
    sample_iter_subs
Returns an iterator of realizations from the expression given a condition
Returns an iterator of realizations from the expression given a condition
def sample_iter(expr, condition=None, numsamples=S.Infinity, **kwargs):
    """
    Returns an iterator of realizations from the expression given a condition

    expr: Random expression to be realized
    condition: A conditional expression (optional)
    numsamples: Length of the iterator (defaults to infinity)

    Examples
    ========

    >>> from sympy.stats import Normal, sample_iter
    >>> X = Normal('X', 0, 1)
    >>> expr = X*X + 3
    >>> iterator = sample_iter(expr, numsamples=3)
    >>> list(iterator) # doctest: +SKIP
    [12, 4, 7]

    See Also
    ========
    Sample
    sampling_P
    sampling_E
    sample_iter_lambdify
    sample_iter_subs
    """
    # lambdify is much faster but not as robust
    try:
        return sample_iter_lambdify(expr, condition, numsamples, **kwargs)
    # use subs when lambdify fails
    except TypeError:
        return sample_iter_subs(expr, condition, numsamples, **kwargs)
def sample_iter ( expr , condition = None , numsamples = S . Infinity , * * kwargs ) : # lambdify is much faster but not as robust try : return sample_iter_lambdify ( expr , condition , numsamples , * * kwargs ) # use subs when lambdify fails except TypeError : return sample_iter_subs ( expr , condition , numsamples , * * kwargs )