Biodata Generator 1.0.0
Procedural human physical characteristics generation for C++23
Loading...
Searching...
No Matches
dasmig::bdg Class Reference

Biodata generator that produces demographically plausible human physical characteristics using country-level population statistics. More...

#include <biodatagen.hpp>

Public Member Functions

 bdg ()=default
 Default constructor — creates an empty generator with no data.
 
 bdg (const bdg &)=delete
 
bdgoperator= (const bdg &)=delete
 
 bdg (bdg &&) noexcept=default
 
bdgoperator= (bdg &&) noexcept=default
 
biodata get_biodata (std::string_view cca2)
 Generate random biodata for a specific country.
 
biodata get_biodata (std::string_view cca2, std::uint64_t call_seed) const
 Generate deterministic biodata for a specific country.
 
biodata get_biodata ()
 Generate random biodata from a random country.
 
biodata get_biodata (std::uint64_t call_seed) const
 Generate deterministic biodata from a random country.
 
biodata get_biodata (std::string_view cca2, sex bio_sex)
 Generate random biodata with a predetermined sex.
 
biodata get_biodata (std::string_view cca2, sex bio_sex, std::uint64_t call_seed) const
 Generate deterministic biodata with a predetermined sex.
 
biodata get_biodata (sex bio_sex)
 Generate random biodata from a random country with a predetermined sex.
 
biodata get_biodata (sex bio_sex, std::uint64_t call_seed) const
 Generate deterministic biodata from a random country with a predetermined sex.
 
bdgseed (std::uint64_t seed_value)
 Seed the internal random engine for deterministic sequences.
 
bdgunseed ()
 Reseed the engine with a non-deterministic source.
 
bool has_data () const
 Check whether any data has been loaded.
 
std::size_t country_count () const
 Return the number of loaded countries.
 
void load (const std::filesystem::path &dir)
 Load biodata from a resource directory.
 
bool load (dataset tier)
 Load a specific dataset tier from auto-probed paths.
 

Static Public Member Functions

static bdginstance ()
 Access the global singleton instance.
 

Detailed Description

Biodata generator that produces demographically plausible human physical characteristics using country-level population statistics.

The generation pipeline:

  1. Select biological sex (50/50 unless forced).
  2. Sample height from a Gaussian (country/sex mean and SD).
  3. Sample BMI from a log-normal distribution.
  4. Derive weight from height and BMI.
  5. Sample eye colour, hair colour, skin type from categorical distributions.
  6. Sample blood type from ABO/Rh distribution.
  7. Sample handedness from country-level left-handedness rate.

Can be used as a singleton via instance() or constructed independently.

Thread safety
Each instance is independent. Concurrent calls to get_biodata() on the same instance require external synchronisation.

Definition at line 258 of file biodatagen.hpp.

Member Function Documentation

◆ country_count()

std::size_t dasmig::bdg::country_count ( ) const
inline

Return the number of loaded countries.

Definition at line 369 of file biodatagen.hpp.

◆ get_biodata() [1/8]

biodata dasmig::bdg::get_biodata ( )
inline

Generate random biodata from a random country.

Exceptions
std::runtime_errorIf no data has been loaded.

Definition at line 300 of file biodatagen.hpp.

◆ get_biodata() [2/8]

biodata dasmig::bdg::get_biodata ( sex  bio_sex)
inline

Generate random biodata from a random country with a predetermined sex.

Definition at line 330 of file biodatagen.hpp.

◆ get_biodata() [3/8]

biodata dasmig::bdg::get_biodata ( sex  bio_sex,
std::uint64_t  call_seed 
) const
inline

Generate deterministic biodata from a random country with a predetermined sex.

Definition at line 339 of file biodatagen.hpp.

◆ get_biodata() [4/8]

biodata dasmig::bdg::get_biodata ( std::string_view  cca2)
inline

Generate random biodata for a specific country.

Parameters
cca2ISO 3166-1 alpha-2 country code (e.g. "US", "BR").
Exceptions
std::runtime_errorIf no data has been loaded.
std::invalid_argumentIf the country code is unknown.

Definition at line 286 of file biodatagen.hpp.

◆ get_biodata() [5/8]

biodata dasmig::bdg::get_biodata ( std::string_view  cca2,
sex  bio_sex 
)
inline

Generate random biodata with a predetermined sex.

Definition at line 314 of file biodatagen.hpp.

◆ get_biodata() [6/8]

biodata dasmig::bdg::get_biodata ( std::string_view  cca2,
sex  bio_sex,
std::uint64_t  call_seed 
) const
inline

Generate deterministic biodata with a predetermined sex.

Definition at line 321 of file biodatagen.hpp.

◆ get_biodata() [7/8]

biodata dasmig::bdg::get_biodata ( std::string_view  cca2,
std::uint64_t  call_seed 
) const
inline

Generate deterministic biodata for a specific country.

Definition at line 292 of file biodatagen.hpp.

◆ get_biodata() [8/8]

biodata dasmig::bdg::get_biodata ( std::uint64_t  call_seed) const
inline

Generate deterministic biodata from a random country.

Definition at line 306 of file biodatagen.hpp.

◆ has_data()

bool dasmig::bdg::has_data ( ) const
inline

Check whether any data has been loaded.

Definition at line 366 of file biodatagen.hpp.

◆ instance()

static bdg & dasmig::bdg::instance ( )
inlinestatic

Access the global singleton instance.

Auto-probes common resource paths on first access.

Definition at line 274 of file biodatagen.hpp.

◆ load() [1/2]

void dasmig::bdg::load ( const std::filesystem::path &  dir)
inline

Load biodata from a resource directory.

Expects the directory to contain: biodata.tsv.

Replaces any previously loaded data.

Definition at line 379 of file biodatagen.hpp.

◆ load() [2/2]

bool dasmig::bdg::load ( dataset  tier)
inline

Load a specific dataset tier from auto-probed paths.

Definition at line 392 of file biodatagen.hpp.

◆ seed()

bdg & dasmig::bdg::seed ( std::uint64_t  seed_value)
inline

Seed the internal random engine for deterministic sequences.

Definition at line 350 of file biodatagen.hpp.

◆ unseed()

bdg & dasmig::bdg::unseed ( )
inline

Reseed the engine with a non-deterministic source.

Definition at line 357 of file biodatagen.hpp.


The documentation for this class was generated from the following file: