Hello community, here is the log from the commit of package ghc-splitmix for openSUSE:Factory checked in at 2020-03-09 14:16:58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-splitmix (Old) and /work/SRC/openSUSE:Factory/.ghc-splitmix.new.26092 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-splitmix" Mon Mar 9 14:16:58 2020 rev:4 rq:780036 version:0.0.4 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-splitmix/ghc-splitmix.changes 2019-12-27 13:57:41.432783608 +0100 +++ /work/SRC/openSUSE:Factory/.ghc-splitmix.new.26092/ghc-splitmix.changes 2020-03-09 14:17:05.366653165 +0100 @@ -1,0 +2,9 @@ +Thu Feb 27 14:17:58 UTC 2020 - psim...@suse.com + +- Update splitmix to version 0.0.4. + Upstream has edited the change log file since the last release in + a non-trivial way, i.e. they did more than just add a new entry + at the top. You can review the file at: + http://hackage.haskell.org/package/splitmix-0.0.4/src/Changelog.md + +------------------------------------------------------------------- Old: ---- splitmix-0.0.3.tar.gz New: ---- splitmix-0.0.4.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-splitmix.spec ++++++ --- /var/tmp/diff_new_pack.P9wsYT/_old 2020-03-09 14:17:06.026653600 +0100 +++ /var/tmp/diff_new_pack.P9wsYT/_new 2020-03-09 14:17:06.030653602 +0100 @@ -1,7 +1,7 @@ # # spec file for package ghc-splitmix # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,7 +19,7 @@ %global pkg_name splitmix %bcond_with tests Name: ghc-%{pkg_name} -Version: 0.0.3 +Version: 0.0.4 Release: 0 Summary: Fast Splittable PRNG License: BSD-3-Clause ++++++ splitmix-0.0.3.tar.gz -> splitmix-0.0.4.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/splitmix-0.0.3/Changelog.md new/splitmix-0.0.4/Changelog.md --- old/splitmix-0.0.3/Changelog.md 2001-09-09 03:46:40.000000000 +0200 +++ new/splitmix-0.0.4/Changelog.md 2001-09-09 03:46:40.000000000 +0200 @@ -1,7 +1,12 @@ +# 0.0.4 +- Add `bitmaskWithRejection32'` and `bitmaskWithRejection64'` + which generate numbers in closed range `[0, n]`. + Unticked variants generate in closed-open range `[0, n)`. + # 0.0.3 - Add `System.Random.SplitMix32` module -- Add `bitmaskWithRejection32` and `bitmaskWithRejection64` module +- Add `bitmaskWithRejection32` and `bitmaskWithRejection64` functions - Add `nextWord32`, `nextTwoWord32` and `nextFloat` - Add `random` flag, dropping dependency on `random` (breaks things, e.g. `QuickCheck`, when disabled). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/splitmix-0.0.3/splitmix.cabal new/splitmix-0.0.4/splitmix.cabal --- old/splitmix-0.0.3/splitmix.cabal 2001-09-09 03:46:40.000000000 +0200 +++ new/splitmix-0.0.4/splitmix.cabal 2001-09-09 03:46:40.000000000 +0200 @@ -1,6 +1,6 @@ cabal-version: >=1.10 name: splitmix -version: 0.0.3 +version: 0.0.4 synopsis: Fast Splittable PRNG description: Pure Haskell implementation of SplitMix described in @@ -33,7 +33,19 @@ category: System, Random build-type: Simple tested-with: - GHC ==8.8.1 || ==8.6.5 || ==8.4.4 || ==8.2.2 || ==8.0.2 || ==7.10.3 || ==7.8.4 || ==7.6.3 || ==7.4.2 || ==7.2.2 || ==7.0.4 + GHC ==7.0.4 + || ==7.2.2 + || ==7.4.2 + || ==7.6.3 + || ==7.8.4 + || ==7.10.3 + || ==8.0.2 + || ==8.2.2 + || ==8.4.4 + || ==8.6.5 + || ==8.8.2 + || ==8.10.1 + , GHCJS ==8.4 extra-source-files: README.md @@ -63,7 +75,7 @@ -- ghc-options: -fplugin=DumpCore -fplugin-opt DumpCore:core-html build-depends: - base >=4.3 && <4.14 + base >=4.3 && <4.15 , deepseq >=1.3.0.0 && <1.5 , time >=1.2.0.3 && <1.10 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/splitmix-0.0.3/src/System/Random/SplitMix.hs new/splitmix-0.0.4/src/System/Random/SplitMix.hs --- old/splitmix-0.0.3/src/System/Random/SplitMix.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/splitmix-0.0.4/src/System/Random/SplitMix.hs 2001-09-09 03:46:40.000000000 +0200 @@ -26,9 +26,9 @@ -- but GHC-7.0 and GHC-7.2 have slow implementation, as there -- are no native 'popCount'. -- -{-# LANGUAGE CPP #-} +{-# LANGUAGE CPP #-} #if __GLASGOW_HASKELL__ >= 702 -{-# LANGUAGE Trustworthy #-} +{-# LANGUAGE Trustworthy #-} #endif module System.Random.SplitMix ( SMGen, @@ -41,7 +41,9 @@ splitSMGen, -- * Generation bitmaskWithRejection32, + bitmaskWithRejection32', bitmaskWithRejection64, + bitmaskWithRejection64', -- * Initialisation mkSMGen, initSMGen, @@ -248,6 +250,36 @@ then go g' else (x', g') +-- | /Bitmask with rejection/ method of generating subrange of 'Word32'. +-- +-- @since 0.0.4 +bitmaskWithRejection32' :: Word32 -> SMGen -> (Word32, SMGen) +bitmaskWithRejection32' range = go where + mask = complement zeroBits `shiftR` countLeadingZeros (range .|. 1) + go g = let (x, g') = nextWord32 g + x' = x .&. mask + in if x' > range + then go g' + else (x', g') + +-- | /Bitmask with rejection/ method of generating subrange of 'Word64'. +-- +-- @bitmaskWithRejection64' w64@ generates random numbers in closed-closed +-- range of @[0, w64]@. +-- +-- >>> take 20 $ unfoldr (Just . bitmaskWithRejection64' 5) (mkSMGen 1337) +-- [3,1,4,1,2,3,1,1,0,3,4,5,2,3,0,2,3,5,3,4] +-- +-- @since 0.0.4 +bitmaskWithRejection64' :: Word64 -> SMGen -> (Word64, SMGen) +bitmaskWithRejection64' range = go where + mask = complement zeroBits `shiftR` countLeadingZeros (range .|. 1) + go g = let (x, g') = nextWord64 g + x' = x .&. mask + in if x' > range + then go g' + else (x', g') + ------------------------------------------------------------------------------- -- Initialisation diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/splitmix-0.0.3/src/System/Random/SplitMix32.hs new/splitmix-0.0.4/src/System/Random/SplitMix32.hs --- old/splitmix-0.0.3/src/System/Random/SplitMix32.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/splitmix-0.0.4/src/System/Random/SplitMix32.hs 2001-09-09 03:46:40.000000000 +0200 @@ -9,9 +9,9 @@ -- but GHC-7.0 and GHC-7.2 have slow implementation, as there -- are no native 'popCount'. -- -{-# LANGUAGE CPP #-} +{-# LANGUAGE CPP #-} #if __GLASGOW_HASKELL__ >= 702 -{-# LANGUAGE Trustworthy #-} +{-# LANGUAGE Trustworthy #-} #endif module System.Random.SplitMix32 ( SMGen, @@ -24,7 +24,9 @@ splitSMGen, -- * Generation bitmaskWithRejection32, + bitmaskWithRejection32', bitmaskWithRejection64, + bitmaskWithRejection64', -- * Initialisation mkSMGen, initSMGen, @@ -245,6 +247,36 @@ then go g' else (x', g') +-- | /Bitmask with rejection/ method of generating subrange of 'Word32'. +-- +-- @since 0.0.4 +bitmaskWithRejection32' :: Word32 -> SMGen -> (Word32, SMGen) +bitmaskWithRejection32' range = go where + mask = complement zeroBits `shiftR` countLeadingZeros (range .|. 1) + go g = let (x, g') = nextWord32 g + x' = x .&. mask + in if x' > range + then go g' + else (x', g') + +-- | /Bitmask with rejection/ method of generating subrange of 'Word64'. +-- +-- @bitmaskWithRejection64' w64@ generates random numbers in closed-closed +-- range of @[0, w64]@. +-- +-- >>> take 20 $ unfoldr (Just . bitmaskWithRejection64' 5) (mkSMGen 1337) +-- [0,2,4,2,1,4,2,4,5,5,2,2,5,3,5,0,3,2,2,2] +-- +-- @since 0.0.4 +bitmaskWithRejection64' :: Word64 -> SMGen -> (Word64, SMGen) +bitmaskWithRejection64' range = go where + mask = complement zeroBits `shiftR` countLeadingZeros (range .|. 1) + go g = let (x, g') = nextWord64 g + x' = x .&. mask + in if x' > range + then go g' + else (x', g') + ------------------------------------------------------------------------------- -- Initialisation -------------------------------------------------------------------------------