# svrng_new_uniform_distribution_[int|float|double]/svrng_update_uniform_distribution_[int|float|double]

Allocates and initializes constants for the uniform distribution with specified parameters

## Syntax

svrng_distribution_t svrng_new_uniform_distribution_int( int a, int b )

svrng_distribution_t svrng_new_uniform_distribution_float( float a, float b )

svrng_distribution_t svrng_new_uniform_distribution_double( double a, double b )

svrng_distribution_t svrng_update_uniform_distribution_int( svrng_distribution_t distr, int a, int b )

svrng_distribution_t svrng_update_uniform_distribution_float( svrng_distribution_t distr, float a, float b )

svrng_distribution_t svrng_update_uniform_distribution_double( svrng_distribution_t distr, double a, double b )

## Input Parameters

a | Left bound of interval
b | Right bound of interval
distr | Pointer to the distribution to be updated

## Description

The svrng_new_uniform_distribution_[int|float|double] function allocates memory for a uniform distribution and pre-computes and broadcasts loop-invariant constants required for vector generation of uniformly distributed values over the interval [a, b), where a, b are the real left and right bounds of the interval respectively with a < b. 32-bit `int`, `float` and `double` types are supported. The svrng_update_uniform_distribution_[int|float|double] functions give the same result, but by modifying existing distributions instead of allocating memory for new distributions.

## Status flags set

Name | Description
--- | ---
SVRNG_STATUS_ERROR_MEMORY_ALLOC | Memory allocation failure
SVRNG_STATUS_ERROR_BAD_PARAMS | a>=b
SVRNG_STATUS_ERROR_BAD_DISTR | Bad distribution (NULL pointer)

## Return Values

A pointer to the distribution created or updated by the function, or NULL on error.

Parent topic: Distribution Initialization and Finalization