fhelium.rng
CKKS-configured CPU/CUDA cryptographically secure sampling.
Csprng
class View source
python
Csprng(num_coefs: int=2 ** 15, num_channels: Sequence[int]=(8,), num_repeating_channels: int=2, sigma: float=3.19, devices: Sequence[torch.device | str] | None=None, torch_dtype: torch.dtype=torch.int64, seed: Any=None, nonce: Any=None)1
FHElium adapter around the standalone triton_csprng package.
The adapter supplies CKKS-specific channel and sampling configuration while delegating ChaCha20 stream generation to the standalone package.
Parameters
num_coefs: Coefficients generated per channel.num_channels: Independent channel count per device, or one count to repeat for every device.num_repeating_channels: Channel count reproduced across devices.sigma: Standard deviation for discrete-Gaussian sampling.devices: CPU or CUDA devices that own generator streams. Defaults to every visible CUDA device.torch_dtype: Integral dtype returned to the engine.seed: Optional key material accepted bytriton-csprng. Fixed seed material is appropriate for controlled tests, not an application production-entropy policy.nonce: Optional base nonce accepted bytriton-csprng. The caller owns nonce uniqueness across independent generator instances.
sigma
property
python
sigma: float1
Discrete-Gaussian standard deviation fixed at construction.
randbytes
method
python
def randbytes(shares: list[int] | None=None, repeats: int=0, reshape: bool=False) -> list[torch.Tensor]: ...1
randint
method
python
def randint(amax: int | list[list[int]], shift: int=0, repeats: int=0) -> list[torch.Tensor]: ...1
discrete_gaussian
method
python
def discrete_gaussian(non_repeats: int | list[int]=0, repeats: int=1) -> list[torch.Tensor]: ...1
randround
method
python
def randround(coef: torch.Tensor) -> torch.Tensor: ...1