git.fiddlerwoaroof.com
sys_stdlib.cc
7d075ab4
 /* Copyright (C) CJ Affiliate
  *
  * You may use, distribute and modify this code under  the
  * terms of the  GNU General Public License  version 2  or
  * later.
  *
  * You should have received a copy of the license with this
  * file. If not, you will find a copy in the "LICENSE" file
  * at https://github.com/cjdev/dual-control.
  */
 
552f2a03
 #include <cstdlib>
 #include <memory>
 
 #include "sys_stdlib.h"
 
7d075ab4
 namespace
 {
 class impl : public stdlib_ifc
 {
 public:
23c0bd4d
     void srand (unsigned int seed) const override
     {
         ::srand (seed);
56917f64
     }
7d075ab4
     int rand() const override
     {
         return ::rand();
     }
552f2a03
 
7d075ab4
 };
552f2a03
 }
 
7d075ab4
 stdlib const &stdlib::get()
 {
552f2a03
     static stdlib singleton {std::make_shared<impl>()};
     return singleton;
 }
7d075ab4