1#ifndef BACKENDS_P4TOOLS_COMMON_LIB_UTIL_H_
2#define BACKENDS_P4TOOLS_COMMON_LIB_UTIL_H_
12#include <boost/random/mersenne_twister.hpp>
25 static boost::random::mt19937 rng;
28 static std::optional<uint32_t> currentSeed;
38 static void setRandomSeed(
int seed);
47 static int64_t
getRandInt(int64_t min, int64_t max);
50 static int64_t
getRandInt(
const std::vector<int64_t> &percent);
57 static big_int
getRandBigInt(
const big_int &min,
const big_int &max);
73 std::string_view methodName,
const std::vector<const IR::Expression *> &argVector,
74 const IR::Type *returnType = IR::Type_Void::get(),
75 const IR::ParameterList *paramList =
new IR::ParameterList());
80 std::shuffle(inp->begin(), inp->end(), rng);
84 template <
typename Iter>
86 int random =
getRandInt(std::distance(start, end) - 1);
87 std::advance(start, random);
93 template <
typename ContainerType>
95 std::stringstream stringStream;
98 auto val = container.cbegin();
99 if (val != container.cend()) {
100 stringStream << *val++;
101 while (val != container.cend()) {
102 stringStream <<
", " << *val++;
106 return stringStream.str();
121 const IR::PathExpression *pathExpr);
125 const IR::Type_Name *type);
The Declaration interface, representing objects with names.
Definition declaration.h:26