o
    }oi                     @  s&   d dl mZ d dlZG dd dZdS )    )annotationsNc                   @  s4   e Zd ZdZddddZdd	d
ZedddZdS )LazyRandomStatezLazy Random State class.


    This is a class to initialize the random state just before use to prevent
    duplication of the same random state when deepcopy is applied to the instance of sampler.
    Nseed
int | NonereturnNonec                 C  s$   d | _ |d ur| jj|d d S d S )N)r   )_rngrngr   )selfr    r   V/home/ubuntu/.local/lib/python3.10/site-packages/optuna/samplers/_lazy_random_state.py__init__   s   zLazyRandomState.__init__c                 C  s   t j | _d S N)nprandomRandomStater   r
   r   r   r   _set_rng   s   zLazyRandomState._set_rngnp.random.RandomStatec                 C  s&   | j d u r	|   | j d usJ | j S r   )r   r   r   r   r   r   r	      s   
zLazyRandomState.rngr   )r   r   r   r   )r   r   )r   r   )__name__
__module____qualname____doc__r   r   propertyr	   r   r   r   r   r      s    
r   )
__future__r   numpyr   r   r   r   r   r   <module>   s    