Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:53:31

0001 //
0002 // Copyright (c) 2017 James E. King III
0003 //
0004 // Distributed under the Boost Software License, Version 1.0.
0005 // (See accompanying file LICENSE_1_0.txt or copy at
0006 //   https://www.boost.org/LICENSE_1_0.txt)
0007 //
0008 // "A Replacement Call for Random"
0009 // https://man.openbsd.org/arc4random.3
0010 //
0011 
0012 #include <cstddef>
0013 #include <stdlib.h>
0014 
0015 namespace boost {
0016 namespace uuids {
0017 namespace detail {
0018 
0019 class random_provider_base
0020 {
0021   public:
0022     //! Obtain entropy and place it into a memory location
0023     //! \param[in]  buf  the location to write entropy
0024     //! \param[in]  siz  the number of bytes to acquire
0025     void get_random_bytes(void *buf, std::size_t siz)
0026     {
0027         arc4random_buf(buf, siz);
0028     }
0029 };
0030 
0031 } // detail
0032 } // uuids
0033 } // boost