UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
Loading...
Searching...
No Matches
Rand_pmms Class Reference

#include <rand_pmms.h>

Collaboration diagram for Rand_pmms:
Collaboration graph

Public Member Functions

 Rand_pmms ()=default
 
unsigned long int pmms_rand (unsigned long int maxv)
 
void seedi (unsigned long int s)
 

Private Member Functions

unsigned long int nextrand ()
 

Private Attributes

unsigned long int seed
 
unsigned long int val
 

Detailed Description

Definition at line 23 of file rand_pmms.h.

Constructor & Destructor Documentation

◆ Rand_pmms()

Rand_pmms::Rand_pmms ( )
default

Member Function Documentation

◆ nextrand()

unsigned long int Rand_pmms::nextrand ( )
inlineprivate

Definition at line 43 of file rand_pmms.h.

44 {
45 unsigned long long int const a = 16807ull;
46 unsigned long long int const m = 0x7FFFFFFFull;
47
48 val = (a * val) % m;
49
50 return val;
51 }
unsigned long int val
Definition rand_pmms.h:54

References val.

Referenced by pmms_rand().

◆ pmms_rand()

unsigned long int Rand_pmms::pmms_rand ( unsigned long int maxv)
inline

Definition at line 35 of file rand_pmms.h.

36 {
37 unsigned long int raw_value = nextrand();
38
39 return (unsigned long) ((double)maxv * (double)raw_value / (double)0x7FFFFFFF);
40 }
unsigned long int nextrand()
Definition rand_pmms.h:43

References nextrand().

Referenced by generate_ldgm_matrix(), and left_matrix_init().

Here is the call graph for this function:

◆ seedi()

void Rand_pmms::seedi ( unsigned long int s)
inline

Definition at line 28 of file rand_pmms.h.

29 {
30 assert(s > 0ul && s < 0x7FFFFFFFul);
31 seed = s;
32 val = s;
33 }
unsigned long int seed
Definition rand_pmms.h:53

References seed, and val.

Referenced by generate_ldgm_matrix(), and left_matrix_init().

Member Data Documentation

◆ seed

unsigned long int Rand_pmms::seed
private

Definition at line 53 of file rand_pmms.h.

Referenced by seedi().

◆ val

unsigned long int Rand_pmms::val
private

Definition at line 54 of file rand_pmms.h.

Referenced by nextrand(), and seedi().


The documentation for this class was generated from the following file: