Class RandomSequence
Defined in File RandomSequence.h
Inheritance Relationships
Base Type
public ska::pst::common::ByteSequence(Class ByteSequence)
Class Documentation
-
class RandomSequence : public ska::pst::common::ByteSequence
Generates a sequence of randomly distributed unsigned 8-bit integer values. The Mersenne Twister random number generator is seeded using a value derived from the UTC_START of the header passed to the configure method.
Public Functions
-
RandomSequence() = default
Construct a new Random Sequence object.
-
~RandomSequence() = default
Destroy the Random Sequence object.
-
virtual void configure(const ska::pst::common::AsciiHeader &header) override
Configure the Random Sequence using parameters in the AsciiHeader.
- Parameters
header – configuration parameters including
UTC_START: used to seed the random number generator
OBS_OFFSET: byte offset into the random sequence
-
virtual void reset() override
Reset the internal state of the random sequence.
- Post
The next call to generate or validate will behave as per the first call to these functions
-
virtual void generate(char *buffer, uint64_t bufsz) override
Generate a sequence of uniformly distributed random unsigned 8-bit integers.
- Parameters
buffer – pointer to memory to which the random sequence should be written
bufsz – number of bytes to write to the buffer
-
virtual bool validate(char *buffer, uint64_t bufsz) override
Compare contents of buffer to expected random sequence.
- Parameters
buffer – pointer to buffer containing bytes to be validated
bufsz – size of the buffer to be validated
- Returns
true if all samples are valid
-
void seek(uint64_t nelements)
Seek forward through the random sequence.
- Parameters
nelements – the number of elements in the sequence to skip over
-
RandomSequence() = default