<commit_before>/******************************************************************************//**
 * @copyright (c) RDO-Team, 2011
 * @file      rdo_random_distribution.inl
 * @authors    
 * @date      02.08.2011
 * @brief       
 * @indent    4T
 *********************************************************************************/

// *********************************************************************** INCLUDES
// *********************************************************************** SYNOPSIS
// ********************************************************************************

OPEN_RDO_RUNTIME_NAMESPACE

// ********************************************************************************
// ******************** RandGenerator
// ********************************************************************************
inline RandGenerator::RandGenerator(long int seed)
	: m_seed(seed)
{}

inline RandGenerator::~RandGenerator()
{}

inline void RandGenerator::setSeed(long int seed)
{
	m_seed = seed;
}

inline double RandGenerator::u01()
{
#ifdef RDO_NATIVE_U01
	m_seed = m_seed * 69069 + 1;
	return m_seed / 4294967296.0; //(long double)UINT_MAX + 1
#else
	const long int MODLUS = 2147483647;
	const long int MULT1  = 24112;
	const long int MULT2  = 26143;
	long int zi = m_seed;
	long int lowprd = (zi & 65535) * MULT1;
	long int hi31   = (zi >> 16) * MULT1 + (lowprd >> 16);
	zi = ((lowprd & 65535) - MODLUS) + ((hi31 & 32767) << 16) + (hi31 >> 15);
	if ( zi < 0 ) zi += MODLUS;
	lowprd = (zi & 65535) * MULT2;
	hi31 = (zi >> 16) * MULT2 + (lowprd >> 16);
	zi = ((lowprd & 65535) - MODLUS) + ((hi31 & 32767) << 16) + (hi31 >> 15);
	if ( zi < 0 ) zi += MODLUS;
	m_seed = zi;
	//return ((zi >> 7) + 1) / 16777216.0;       //     FORTRAN imho
	return (((zi >> 7) | 1) + 1) / 16777216.0; //     C
#endif
}

// ********************************************************************************
// ******************** RandGeneratorUniform
// ********************************************************************************
inline RandGeneratorUniform::RandGeneratorUniform(long int seed)
	: RandGenerator(seed)
{}

inline double RandGeneratorUniform::next(double from, double to)
{
	return u01() * (to - from) + from;
}

// ********************************************************************************
// ******************** RandGeneratorExponential
// ********************************************************************************
inline RandGeneratorExponential::RandGeneratorExponential(long int seed)
	: RandGenerator(seed)
{}

inline double RandGeneratorExponential::next(double math)
{
	return -log(u01()) * math;<commit_msg> - форматирование<commit_after>/******************************************************************************//**
 * @copyright (c) RDO-Team, 2011
 * @file      rdo_random_distribution.inl
 * @authors    
 * @date      02.08.2011
 * @brief       
 * @indent    4T
 *********************************************************************************/

// *********************************************************************** INCLUDES
// *********************************************************************** SYNOPSIS
// ********************************************************************************

OPEN_RDO_RUNTIME_NAMESPACE

// ********************************************************************************
// ******************** RandGenerator
// ********************************************************************************
inline RandGenerator::RandGenerator(long int seed)
	: m_seed(seed)
{}

inline RandGenerator::~RandGenerator()
{}

inline void RandGenerator::setSeed(long int seed)
{
	m_seed = seed;
}

inline double RandGenerator::u01()
{
#ifdef RDO_NATIVE_U01
	m_seed = m_seed * 69069 + 1;
	return m_seed / 4294967296.0; //(long double)UINT_MAX + 1
#else
	const long int MODLUS = 2147483647;
	const long int MULT1  = 24112;
	const long int MULT2  = 26143;
	long int zi = m_seed;
	long int lowprd = (zi & 65535) * MULT1;
	long int hi31   = (zi >> 16) * MULT1 + (lowprd >> 16);
	zi = ((lowprd & 65535) - MODLUS) + ((hi31 & 32767) << 16) + (hi31 >> 15);
	if (zi < 0) zi += MODLUS;
	lowprd = (zi & 65535) * MULT2;
	hi31 = (zi >> 16) * MULT2 + (lowprd >> 16);
	zi = ((lowprd & 65535) - MODLUS) + ((hi31 & 32767) << 16) + (hi31 >> 15);
	if (zi < 0) zi += MODLUS;
	m_seed = zi;
	//return ((zi >> 7) + 1) / 16777216.0;       //     FORTRAN imho
	return (((zi >> 7) | 1) + 1) / 16777216.0; //     C
#endif
}

// ********************************************************************************
// ******************** RandGeneratorUniform
// ********************************************************************************
inline RandGeneratorUniform::RandGeneratorUniform(long int seed)
	: RandGenerator(seed)
{}

inline double RandGeneratorUniform::next(double from, double to)
{
	return u01() * (to - from) + from;
}

// ********************************************************************************
// ******************** RandGeneratorExponential
// ********************************************************************************
inline RandGeneratorExponential::RandGeneratorExponential(long int seed)
	: RandGenerator(seed)
{}

inline double RandGeneratorExponential::next(double math)
{
	return -log(u01()) * math;
{'fraction_non_alphanumeric': 0.4523899848254932, 'fraction_numerical': 0.05614567526555387, 'mean_word_length': 5.509876543209876, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4154598', 'n_tokens_mistral': 1705, 'n_tokens_neox': 1423, 'n_words': 330}