Class NormalSequence
Defined in File NormalSequence.h
Class Documentation
-
class NormalSequence
Generates a sequence of normally distributed integer values. The configuration of the distribution is controlled by header supplied in the configure method, through the following parameters: DISTRIBUTION_MEAN: mean of the values DISTRIBUTION_STDDEV: standard deviation of the values NBIT: Number of bits per sample in the values.
Public Functions
-
NormalSequence() = default
Construct a new Normal Sequence object.
-
~NormalSequence() = default
Destroy the Normal Sequence object.
-
void configure(const ska::pst::common::AsciiHeader &header)
Configure the Normal Sequence using the meta data present in the AsciiHeader.
- Parameters
header – header containing a UTC_START and OBS_OFFSET key/val pair
-
inline void set_stddev(float _stddev)
Set the standard deviation of the generated data.
- Parameters
stddev – the standard deviation of the normal distribution
-
void reset()
Reset the internal state of the Normal Sequence. The next call to generate or validate will behave as per the first call to these functions.
-
void generate(char *buffer, uint64_t bufsz)
Generate a random sequence of normally distributed unsigned 8-bit or 16-bit integers. Each random number generated advances the sequence of random numbers.
- Parameters
buffer – pointer to memory to which the random sequence should be written
bufsz – number of elements to write to the buffer
-
auto validate(char *buffer, uint64_t bufsz) -> bool
Compare contents of buffer to expected random sequence.
- Parameters
buffer – pointer to buffer containing samples to be validated
bufsz – size of the buffer to be validated
- Returns
true if all samples are valid
- Returns
false if any samples are invalid
-
NormalSequence() = default