## Intel® High Level Synthesis Compiler Pro Edition: Reference Manual

ID 683349
Date 3/28/2022
Public

A newer version of this document is available. Customers should click here to go to the newest version.

## A.1. Random Number Generator Library

The random number generator source code library provided with the Intel® HLS Compiler Pro Edition gives you FPGA-optimized random number generator template classes that you can add to your component without needing to write your own.

### The Random Number Generator Library and Cryptography

The use of these pseudo-random number generator (PRNG) algorithms are not recommended for cryptographic purposes. The PRNGs included in this library are not cryptographically-secure pseudo-random number generators (CSPRNGs) and should not be used for cryptography. CSPRNG algorithms are designed so that no polynomial-time algorithm (PTA) can compute or predict the next bit in the pseudo-random sequence, nor is there a PTA that can predict past values of the CSPRNG; these algorithms do not achieve this purpose. Additionally, these algorithms have not been reviewed nor are they recommended for use as a PRNG component of a CSPRNG, even if the input values are from a non-deterministic entropy source with an appropriate entropy extractor.

Table 61.  Properties of Values That Can Be Generated by the Intel® HLS Compiler Random Number Generator Library
Value distribution Value type Value range Generation method
Uniform Integer [-2³¹, 2³¹-1] Tausworthe Generator
Floating point [0, 1) (non-inclusive) Tausworthe Generator
Gaussian Floating point [0, 1) Central limit theorem (CLT) (Default)
Box-Muller

To include the random number generator library in your component, add the following line to your component:
#include "HLS/rand_lib.h"

The header file is self-documented. You can review the header file to learn how to use the random number generator library in your component.

### Random Number Object Declarations

Declare random number objects in your components as follows. In all cases, specifying <seed_value> is optional.
• Uniform distribution integer random number
static RNG_Uniform<int> <object_name>(<seed_value>)
• Uniform distribution floating point random number
static RNG_Uniform<float> <object_name>(<seed_value>)
• Gaussian distribution floating point random number (CLT method)
static RNG_Gaussian<float> <object_name>(<seed_value>)
or
static RNG_Gaussian<float, ihc::GAUSSIAN_CLT> <object_name>(<seed_value>)
• Gaussian distribution floating point random number (Box-Muller method)
static RNG_Gaussian<float, ihc::GAUSSIAN_BOX_MULLER> <object_name>(<seed_value>)

Did you find the information on this page useful?

Characters remaining:

Feedback Message