Class Random

Class Documentation

class Random

Public Functions

explicit Random(uint32_t seed = static_cast<uint32_t>(time(NULL)))

Constructor to initialize the seed to a known value to make experiments reproducible.

double getRandomDouble()

Get a random double \(\in [0, 1]\).

Returns:

Double \(\in [0, 1]\)

double getRandomLinear(double min, double max)

Get a random double in a range with uniform probability.

Parameters:
  • min – Minimum of the range

  • max – Maximum of the range

Returns:

Double \(\in [min, max]\)

double getRandomExp(double min, double max)

Get a random double in a range with exponential probability.

Lower values are more probable than higher ones.

Parameters:
  • min – Minimum of the range

  • max – Maximum of the range

Returns:

Double \(\in [min, max]\)

double getRandomExpDist(double lambda)

Get a random double in a range [0;+inf) with exponential probability.

Lower values are more probable than higher ones.

Parameters:

lambda – is the rate parameter

Returns:

Double > 0

double getAngleRandom()

Return a random angle in radians.

Returns:

random angle \( \in [0, 2\pi) \)

f2c::types::Cell generateRandCell(double area, int n_sides, double min_width = 0.5, double max_width = 1.0)
f2c::types::Field generateRandField(double area, int n_sides, double min_width = 0.5, double max_width = 1.0)

Random field generator to make tests.

Parameters:
  • area – Area of the generated field

  • n_sides – Number of sides of the generated field.

  • min_width – Minimum distance to the center for the base field.

  • max_width – Maximum distance to the center for the base field.

Returns:

Field with area area an n_sides.

f2c::types::Cell genConvexCell(double area, size_t n_sides = 4)
f2c::types::Field genConvexField(double area, size_t n_sides = 4)

Generate a convex field.

Parameters:

area – Area of the generated field

f2c::types::Cell genNonConvexCell(double area)
f2c::types::Field genNonConvexField(double area)

Generate a non-convex field.

Parameters:

area – Area of the generated field