Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-14 08:50:59

0001 //------------------------------- -*- C++ -*- -------------------------------//
0002 // Copyright Celeritas contributors: see top-level COPYRIGHT file for details
0003 // SPDX-License-Identifier: (Apache-2.0 OR MIT)
0004 //---------------------------------------------------------------------------//
0005 //! \file corecel/random/params/XorwowRngParams.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include "corecel/Types.hh"
0010 #include "corecel/cont/Array.hh"
0011 #include "corecel/data/CollectionMirror.hh"
0012 #include "corecel/data/ParamsDataInterface.hh"
0013 #include "corecel/random/data/XorwowRngData.hh"
0014 
0015 namespace celeritas
0016 {
0017 //---------------------------------------------------------------------------//
0018 /*!
0019  * Shared data for XORWOW pseudo-random number generator.
0020  */
0021 class XorwowRngParams final : public ParamsDataInterface<XorwowRngParamsData>
0022 {
0023   public:
0024     // Construct with a low-entropy seed
0025     explicit XorwowRngParams(unsigned int seed);
0026 
0027     //! \todo Construct with a seed of 256 bytes (16-byte hex) or shasum string
0028     // explicit XorwowRngParams(const std::string& hexstring);
0029 
0030     //! Access material properties on the host
0031     HostRef const& host_ref() const final { return data_.host_ref(); }
0032 
0033     //! Access material properties on the device
0034     DeviceRef const& device_ref() const final { return data_.device_ref(); }
0035 
0036   private:
0037     //// DATA ////
0038 
0039     // Host/device storage and reference
0040     CollectionMirror<XorwowRngParamsData> data_;
0041 
0042     //// TYPES ////
0043 
0044     using JumpPoly = Array<unsigned int, 5>;
0045     using ArrayJumpPoly = Array<JumpPoly, 32>;
0046 
0047     //// HELPER FUNCTIONS ////
0048 
0049     ArrayJumpPoly const& get_jump_poly();
0050     ArrayJumpPoly const& get_jump_subsequence_poly();
0051 };
0052 
0053 //---------------------------------------------------------------------------//
0054 }  // namespace celeritas