# Presentation: 884267

## The hep_random Library

- A component of the coming C++ standard and of LHC MathCore

## The standard random library

- Proposed for inclusion in C++ standard
- Has made it into TR1
- Engines (random number “generators”) and distributions
- Early package in Boost written by Jens Maurer
- Significant conceptual revamping with heavy input from FNAL
- Based on CLHEP Random experience

## What is hep_random

- A fully compliant implementation of the proposed standard random library
- With those tweaks we are relatively sure will be accepted by the standards committee
- Suitable as a “reference implementation”
- The standard does not like to incorporate completely groundbreaking art...
- Users of hep_random will find transition to std::random trivial
- Namespace will change

## What are the advantages in having this in the standard library

- Avoid any temptation for each physics group to “roll your own”
- Engines can have subtle traps that lead to incorrect physics results!
- Weight of the compiler vendors and world of developers behind improvements
- We are good
- They are often better
- No issue of portability
- (except for non-compliant compilers)
- Let compiler vendors do the maintenance

## Nature of the random library

- Concepts mostly the same as for CLHEP
- Engines
- Distributions
- Some features that are clearly remnants of Fortran-style programming are gone
- Designed to easily be extended
- New distributions; new engines; ...
- Heavily templated for maximal user control

## In what ways does hep_random differ from CLHEP/Random?

- They are much more similar than different!
- Better model of expressing sharing/not sharing of engines
- Engine used is always explicit in distribution invocation
- Slightly different set of engines and distributions
- We will be providing an extension that supplies all the “missing” ones, for the HEP community
- A significant new distribution that allows for variates from a general user-supplied pdf function

## Where are we now?

- We have the proposed final wording of the library specification in a proposal to J16
- Some final tweaks will appear, but mostly...
- We were able to say with honesty that the issues one discovers by implementing the standard have been explored
- We have our reference implementation just about completed
- Some alternate algorithms for some distributions have to be tested and vetted or excised
- We are in serious User’s Guide writing mode

## Forward From Here

- Two possible paths:
- Submit it to Boost
- Create a Boost-independent version

## The Boost Path

- Submit hep_random for inclusion in Boost
- Our code already uses Boost
- All the experiments we work with already use Boost
- This is the best way of gaining widespread visibility
- Which also means people helping to improve the library
- Will need to modify code and prepare build files for Boost build
- This is the path requiring the least work

## The Non-Boost Path

- Modify the code, removing Boost dependencies
- Package it suitable for any/all of:
- MathCore (thus LHC expts, and ROOT)
- Geant4
- CLHEP (as an underlying implementation)
- Requires more work than submission to Boost requires
- Magnitude of the task depends upon how well these groups can agree on things, and how much of their own styles each group insists upon