| Safe Haskell | None |
|---|
Data.Random.Source.Internal.Words
Description
A few little functions I found myself writing inline over and over again.
- buildWord16 :: Word8 -> Word8 -> Word16
- buildWord32 :: Word8 -> Word8 -> Word8 -> Word8 -> Word32
- buildWord32' :: Word16 -> Word16 -> Word32
- buildWord64 :: Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word64
- buildWord64' :: Word16 -> Word16 -> Word16 -> Word16 -> Word64
- buildWord64'' :: Word32 -> Word32 -> Word64
- word32ToFloat :: Word32 -> Float
- word32ToFloatWithExcess :: Word32 -> (Float, Word32)
- wordToFloat :: Word64 -> Float
- wordToFloatWithExcess :: Word64 -> (Float, Word64)
- wordToDouble :: Word64 -> Double
- word32ToDouble :: Word32 -> Double
- wordToDoubleWithExcess :: Word64 -> (Double, Word64)
Documentation
buildWord16 :: Word8 -> Word8 -> Word16Source
Build a word out of 2 bytes. No promises are made regarding the order
in which the bytes are stuffed. Note that this means that a RandomSource
or MonadRandom making use of the default definition of getRandomWord, etc.,
may return different random values on different platforms when started
with the same seed, depending on the platform's endianness.
buildWord32 :: Word8 -> Word8 -> Word8 -> Word8 -> Word32Source
Build a word out of 4 bytes. No promises are made regarding the order
in which the bytes are stuffed. Note that this means that a RandomSource
or MonadRandom making use of the default definition of getRandomWord, etc.,
may return different random values on different platforms when started
with the same seed, depending on the platform's endianness.
buildWord32' :: Word16 -> Word16 -> Word32Source
buildWord64 :: Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word64Source
Build a word out of 8 bytes. No promises are made regarding the order
in which the bytes are stuffed. Note that this means that a RandomSource
or MonadRandom making use of the default definition of getRandomWord, etc.,
may return different random values on different platforms when started
with the same seed, depending on the platform's endianness.
buildWord64'' :: Word32 -> Word32 -> Word64Source
word32ToFloat :: Word32 -> FloatSource
word32ToFloatWithExcess :: Word32 -> (Float, Word32)Source
Same as word32ToFloat, but also return the unused bits (as the 9
least significant bits of a Word32)
wordToFloat :: Word64 -> FloatSource
wordToFloatWithExcess :: Word64 -> (Float, Word64)Source
Same as wordToFloat, but also return the unused bits (as the 41
least significant bits of a Word64)
wordToDouble :: Word64 -> DoubleSource
word32ToDouble :: Word32 -> DoubleSource