summaryrefslogtreecommitdiff
path: root/gr-blocks/lib/random_pdu_impl.cc
diff options
context:
space:
mode:
authorMarcus Müller <mmueller@gnuradio.org>2019-10-05 17:20:53 +0200
committerMartin Braun <martin.braun@ettus.com>2020-01-02 18:06:50 -0800
commit6fb8fcd299c9522ce05f6682f4ea94b2c691835c (patch)
treea18f11d5707f49c33854c8145ad975553cdcb009 /gr-blocks/lib/random_pdu_impl.cc
parent863490f489c2e0cb73ee5a4bff8f288fdf916cd5 (diff)
random_pdu: random facilities use C++11 (minus boost)
Diffstat (limited to 'gr-blocks/lib/random_pdu_impl.cc')
-rw-r--r--gr-blocks/lib/random_pdu_impl.cc6
1 files changed, 2 insertions, 4 deletions
diff --git a/gr-blocks/lib/random_pdu_impl.cc b/gr-blocks/lib/random_pdu_impl.cc
index 75d825aefa..4d847fc25c 100644
--- a/gr-blocks/lib/random_pdu_impl.cc
+++ b/gr-blocks/lib/random_pdu_impl.cc
@@ -45,8 +45,6 @@ random_pdu_impl::random_pdu_impl(int min_items,
: block("random_pdu", io_signature::make(0, 0, 0), io_signature::make(0, 0, 0)),
d_urange(min_items, max_items),
d_brange(0, 255),
- d_rvar(d_rng, d_urange),
- d_bvar(d_rng, d_brange),
d_mask(byte_mask),
d_length_modulo(length_modulo)
{
@@ -69,13 +67,13 @@ bool random_pdu_impl::start()
void random_pdu_impl::output_random()
{
// pick a random vector length
- int len = d_rvar();
+ int len = d_urange(d_rng);
len = std::max(d_length_modulo, len - len % d_length_modulo);
// fill it with random bytes
std::vector<unsigned char> vec(len);
for (int i = 0; i < len; i++)
- vec[i] = ((unsigned char)d_bvar()) & d_mask;
+ vec[i] = ((unsigned char)d_brange(d_rng)) & d_mask;
// send the vector
pmt::pmt_t vecpmt(pmt::make_blob(&vec[0], len));