DCMTK: OFRandom Class Reference

DCMTK Version 3.6.9 OFFIS DICOM Toolkit

Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
OFRandom Class Reference

## Public Member Functions
| OFRandom ()
| default constructor, initializes the PRNG based on time(2) and clock(2).
virtual | ~OFRandom ()
| destructor
Uint64 | getRND64 ()
| return a random Uint64 value
Uint32 | getRND32 ()
| return a random Uint32 value
Uint16 | getRND16 ()
| return a random Uint16 value
void | seed (Uint32 sval)
| Re-seed the PRNG with the given parameter.

## Private Member Functions
void | isaac ()
| generate next round of random numbers.
void | mixSeed ()
| mix the seed values and then generate the first round of random numbers.

## Private Attributes
Uint32 | randcnt
| number of random bytes still available before isaac() needs to called again
Uint32 | randrsl [OFRandom_SIZ]
| random memory
Uint32 | randmem [OFRandom_SIZ]
| internal state of the PRNG
Uint32 | randa
| internal state of the PRNG
Uint32 | randb
| internal state of the PRNG
Uint32 | randc
| internal state of the PRNG

## Member Function Documentation

## ◆ getRND16()

Uint16 OFRandom::getRND16 | ( |  | ) |

return a random Uint16 value

Returns
  random unsigned 16-bit number

## ◆ getRND32()

Uint32 OFRandom::getRND32 | ( |  | ) |

return a random Uint32 value

Returns
  random unsigned 32-bit number

## ◆ getRND64()

Uint64 OFRandom::getRND64 | ( |  | ) |

return a random Uint64 value

Returns
  random unsigned 64-bit number

## ◆ isaac()

void OFRandom::isaac | ( |  | ) |
| private

generate next round of random numbers.

Calling this method will cause the algorithm to generate a new set of random numbers in randrsl.

## ◆ seed()

void OFRandom::seed | ( | Uint32 | sval | ) |

Re-seed the PRNG with the given parameter.

This method should only be used when a reproducible sequence of pseudo-random numbers is desired, e.g. in test routines.

Parameters

  sval | seed value

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

- ofstd/include/dcmtk/ofstd/ofrand.h

Generated on Sat Mar 1 2025 for DCMTK Version 3.6.9 by Doxygen 1.13.2