Permalink
Browse files

Added newSeed

  • Loading branch information...
1 parent cee7b55 commit ac72cd854a62375e60550d3ab34394cc0d158ff1 @bjpop committed Apr 7, 2011
Showing with 9 additions and 0 deletions.
  1. +1 −0 src/Sprng.hs
  2. +2 −0 src/Sprng/Internal.hs
  3. +5 −0 src/cbits/sprng_wrapper.cpp
  4. +1 −0 src/include/sprng_wrapper.h
View
@@ -2,6 +2,7 @@ module Sprng
( RNG {- abstract -}
, SprngGen (..)
, LFG, LCG, LCG64, CMRG, MLFG, PMLCG
+ , Internal.newSeed
) where
import qualified Sprng.Internal as Internal
View
@@ -11,6 +11,7 @@ module Sprng.Internal
, getRandomDouble
, printRng
, spawnRng
+ , newSeed
) where
import Foreign.Ptr (Ptr, FunPtr)
@@ -23,6 +24,7 @@ type SprngPtr = Ptr ()
data RngType = LFG | LCG | LCG64 | CMRG | MLFG | PMLCG
deriving (Eq, Show, Enum)
+foreign import ccall "new_seed" newSeed :: IO Int
foreign import ccall "new_rng" new_rng :: CInt -> IO SprngPtr
foreign import ccall "init_rng" init_rng :: SprngPtr -> CInt -> CInt -> CInt -> CInt -> IO ()
foreign import ccall "get_rn_int" get_rn_int :: SprngPtr -> IO CInt
@@ -1,5 +1,10 @@
#include "sprng_wrapper.h"
+int new_seed(void)
+{
+ return make_new_seed();
+}
+
Sprng * new_rng(int type)
{
return SelectType(type);
@@ -4,6 +4,7 @@
#include "sprng.h"
#include "sprng_cpp.h"
+extern "C" int new_seed(void);
extern "C" Sprng * new_rng(int);
extern "C" void init_rng(Sprng *, int, int, int, int);
extern "C" int get_rn_int(Sprng *);

0 comments on commit ac72cd8

Please sign in to comment.