## distributions.TruncatedDistribution


Truncated Distribution implementation.


Usage

``` python
distributions.TruncatedDistribution(
    dist_to_truncate,
    lower_bound,
)
```


Wraps any distribution conforming to the Distribution protocol and truncates samples at a specified lower bound. No resampling is performed; the class simply ensures no values are below the lower bound.

This class itself conforms to the Distribution protocol.


## Methods

| Name | Description |
|----|----|
| [__init__()](#__init__) | Initialize a truncated distribution. |
| [sample()](#sample) | Generate random samples from the truncated distribution. |

------------------------------------------------------------------------


#### \_\_init\_\_()


Initialize a truncated distribution.


Usage

``` python
__init__(dist_to_truncate, lower_bound)
```


##### Parameters


`dist_to_truncate: Distribution`  
Any object conforming to the Distribution protocol that generates samples.

`lower_bound: float`  
Truncation point. Any samples below this value will be set to this value.


------------------------------------------------------------------------


#### sample()


Generate random samples from the truncated distribution.


Usage

``` python
sample(size=None)
```


##### Parameters


`size: Optional[Union[int, Tuple[int, …]]] = None`  
The number/shape of samples to generate:

- If None: returns a single sample as a float
- If int: returns a 1-D array with that many samples
- If tuple of ints: returns an array with that shape


##### Returns


`Union[float, NDArray[np.float64]]`  
Random samples from the truncated distribution:

- A single float when size is None
- A numpy array of floats with shape determined by size parameter


##### Notes

All values will be greater than or equal to the specified lower bound.
