Libftpp
A modern C++ library
Random2DCoordinateGenerator Class Reference

2D Coordinate-Based Random Number Generator More...

#include <random_2D_coordinate_generator.hpp>

Public Member Functions

 Random2DCoordinateGenerator ()
 Default constructor that initializes the seed based on the current time, process ID, and a random value. More...
 
 Random2DCoordinateGenerator (long long seed)
 Constructor that initializes the generator with a user-defined seed. More...
 
long long seed ()
 
long long operator() (const long long &x, const long long &y)
 

Detailed Description

2D Coordinate-Based Random Number Generator

Note
Generates consistent pseudo-random numbers based on 2D coordinates and a seed.
Random2DCoordinateGenerator rng1; // Seed based on current time
Random2DCoordinateGenerator rng2(42); // Seed based on user-defined value
long long randomValue1 = rng1(10, 20); // Get random value for coordinates (10, 20)
long long randomValue2 = rng2(10, 20); // Get random value for coordinates (10, 20)
2D Coordinate-Based Random Number Generator

Definition at line 21 of file random_2D_coordinate_generator.hpp.

Constructor & Destructor Documentation

◆ Random2DCoordinateGenerator() [1/2]

Random2DCoordinateGenerator::Random2DCoordinateGenerator ( )

Default constructor that initializes the seed based on the current time, process ID, and a random value.

Definition at line 14 of file random_2D_coordinate_generator.cpp.

◆ Random2DCoordinateGenerator() [2/2]

Random2DCoordinateGenerator::Random2DCoordinateGenerator ( long long  seed)

Constructor that initializes the generator with a user-defined seed.

Parameters
seedUser-defined seed for the random number generator.

Definition at line 8 of file random_2D_coordinate_generator.cpp.

Member Function Documentation

◆ operator()()

long long Random2DCoordinateGenerator::operator() ( const long long &  x,
const long long &  y 
)

Definition at line 35 of file random_2D_coordinate_generator.cpp.

◆ seed()

long long Random2DCoordinateGenerator::seed ( )

Definition at line 30 of file random_2D_coordinate_generator.cpp.