Random Source: Difference between revisions

From GNU Radio
Jump to navigation Jump to search
(Add comparison to Random Unifrom Source)
(Rectifying misleading random number quality)
Line 6: Line 6:
Supports an output of type int, short, and byte.
Supports an output of type int, short, and byte.


This block differs from [[Random Uniform Source]] in the pseudorandom number generator used. This block uses Numpy to generate random values through the [https://en.wikipedia.org/wiki/Mersenne_Twister MT19937] algorithm which [https://prng.di.unimi.it has been shown] to be require more processing time but be more numerically stable than the [https://xoroshiro.di.unimi.it/xoroshiro128plus.c xoroshiro128+] algorithm used in [[Random Uniform Source]].
This block differs from [[Random Uniform Source]]:
 
This block uses Numpy to generate a fixed random vector of values. The output of this block repeats every <code>num_samples</code>, and hence has high autocorrelation with that period.<br>
The algorithms used to generate the random numbers differ, as well: Numpy, and hence Random Source, use https://en.wikipedia.org/wiki/Mersenne_Twister MT19937] (but the slightly superior randomness properties don't matter within the maximum size of a vector of values on a PC), whereas the [[Random Uniform Source]] uses https://xoroshiro.di.unimi.it/xoroshiro128plus.c XOROSHIRO128+], which has a period of 2<sup>128</sup>-1 and is hence to be preferred if autocorrelation over a window of length <code>num_samps</code> is relevant.


== Parameters ==
== Parameters ==

Revision as of 15:34, 13 January 2022

Generates a number of samples of random numbers of [min, max) meaning the max value won't be included. Repeat samples if specified. Great for creating bytes of information for a modulator.

Ex: With min=0 and max=2, the sequence 01110101... will be generated.

Supports an output of type int, short, and byte.

This block differs from Random Uniform Source:

This block uses Numpy to generate a fixed random vector of values. The output of this block repeats every num_samples, and hence has high autocorrelation with that period.
The algorithms used to generate the random numbers differ, as well: Numpy, and hence Random Source, use https://en.wikipedia.org/wiki/Mersenne_Twister MT19937] (but the slightly superior randomness properties don't matter within the maximum size of a vector of values on a PC), whereas the Random Uniform Source uses https://xoroshiro.di.unimi.it/xoroshiro128plus.c XOROSHIRO128+], which has a period of 2128-1 and is hence to be preferred if autocorrelation over a window of length num_samps is relevant.

Parameters

(R): Run-time adjustable

Param 1 (R)
Description of parameter, provide any tips or recommended values. Note that the name of the parameter above should match the param's label that shows up in grc (e.g. Sample Rate).
Param 2
blah blah blah

Example Flowgraph

Random-source-ex.png

Source Files

C++ files
TODO
Header files
TODO
Public header files
TODO
Block definition
TODO