randomness implementation.
Changed from memset with a single random byte to std::generate_n()
with per-byte randomness, matching Crimson.
Signed-off-by: Ronen Friedman <rfriedma@redhat.com>
#include "acconfig.h"
+#include <algorithm>
#include <cctype>
#include <fstream>
#include <iomanip>
std::string nm;
unsigned offset = 0;
bufferptr bp(bsize);
- memset(bp.c_str(), random_gen() & 0xff, bp.length());
+ std::generate_n(bp.c_str(), bp.length(), [&random_gen]() {
+ return static_cast<char>(random_gen() & 0xff);
+ });
bl.push_back(std::move(bp));
bl.rebuild_page_aligned();
if (onum && osize) {