Skip to content

core: Add a UniformRandomVariable wrapper to meet UniformRandomBitGenerator requirements

This MR implements a suggestion that @tommypec provided in the context of MR !1772 (merged).

The UniformRandomVariable wrapper that meets the UniformRandomBitGenerator requirements allows us to use std::shuffle (and many of the functions in the standard random library) in a way that preserves repeatability of the experiments (by exploiting the existing ns-3 framework).

Sample usage:

    RngSeedManager::SetSeed(1);
    RngSeedManager::SetRun(4);

    std::vector<uint16_t> vec{0, 1, 2, 3, 4, 5, 6, 7};
    UniformRandomBitGenerator rng(CreateObject<UniformRandomVariable>());
    rng.GetRv()->SetStream(100);
    std::shuffle(vec.begin(), vec.end(), rng);
Edited by Stefano Avallone

Merge request reports