| Server IP : 162.241.219.206 / Your IP : 216.73.216.195 Web Server : Apache System : Linux box5669.bluehost.com 5.14.0-687.15.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jun 11 08:51:45 EDT 2026 x86_64 User : signavd5 ( 2863) PHP Version : 8.3.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/libexec/oracle-cloud-agent/plugins/osms/oci_agent_utils/ |
Upload File : |
a
���f � @ s( d Z ddlZdd� Zdd� Zdd� ZdS )zd
This package provides random methods that considered secure for certain static code analysis tools
� Nc C s| | |krt d��nf| |kr| S || d }d}tt�d��� d�}|||| krhtt�d��� d�}qB||; }| | S dS )z�
Python random.randint() is considered insecure.
We use this function to get around of the restriction.
:param a: lower bound
:param b: upper bound
:return: Return a random integer N such that a <= N <= b.
z'Lower bound is larger than upper bound.� l �� � � N)�
ValueError�int�os�urandom�hex)�a�b�m�rand_max�n� r �M/sparta/input/python_modules/oci_agent_utils/oci_agent_utils/secure_random.py�
random_int
s
r c C s6 t | �} t| �}|dkr td��td|d �}| | S )�.Pick a random element of the given small arrayr zCannot pick from an empty arrayr ��list�lenr r ��source�length�positionr r r �random_element s r c C s6 t | �} t| �}|dkr td��td|d �}| | S )r r zCannot pick from empty arrayr r r r r r r * s )�__doc__r r r r r r r �<module> s