File: content.h

package info (click to toggle)
workflow 1.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,732 kB
  • sloc: cpp: 33,835; ansic: 8,951; makefile: 9; sh: 6
file content (21 lines) | stat: -rw-r--r-- 399 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#ifndef _BENCHMARK_CONTENT_H_
#define _BENCHMARK_CONTENT_H_

#include <random>
#include <string>

static inline std::string make_content(size_t length)
{
	std::mt19937_64 gen{42};
	std::uniform_int_distribution<int> dis{32, 126};

	std::string s;
	s.reserve(length);
	for (size_t i = 0; i < length; i++)
	{
		s.push_back(static_cast<char>(dis(gen)));
	}
	return s;
}

#endif //_BENCHMARK_CONTENT_H_