From 739184db607b9fe1b1ffe0c7dcf10149e875eba4 Mon Sep 17 00:00:00 2001
From: Adam Vogt <vogt.adam@gmail.com>
Date: Tue, 20 Oct 2009 18:59:24 +0200
Subject: Share one StdGen between RGB channels in A.RandomBackground

Ignore-this: 15eef05c9a73d578f5513550757bb8bb

darcs-hash:20091020165924-1499c-f6e8db74e8d4ad712435f1f4a54913c416ef52ad.gz
---
 XMonad/Actions/RandomBackground.hs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'XMonad/Actions')

diff --git a/XMonad/Actions/RandomBackground.hs b/XMonad/Actions/RandomBackground.hs
index 8634a97..c0bbe56 100644
--- a/XMonad/Actions/RandomBackground.hs
+++ b/XMonad/Actions/RandomBackground.hs
@@ -24,7 +24,7 @@ module XMonad.Actions.RandomBackground (
 import XMonad(X, XConf(config), XConfig(terminal), io, spawn,
               MonadIO, asks)
 import System.Random
-import Control.Monad(replicateM,liftM)
+import Control.Monad(liftM)
 import Numeric(showHex)
 
 -- $usage
@@ -55,7 +55,7 @@ randPermutation xs g = swap $ zip (randoms g) xs
 
 -- | @randomBg'@ produces a random hex number in the form @'#xxyyzz'@
 randomBg' ::  (MonadIO m) => RandomColor -> m String
-randomBg' (RGB l h) = liftM toHex $ replicateM 3 $ io $ randomRIO (l,h)
+randomBg' (RGB l h) = io $ liftM (toHex . take 3 . randomRs (l,h)) newStdGen
 randomBg' (HSV s v) = io $ do
     g <- newStdGen
     let x = (^(2::Int)) $ fst $ randomR (0,sqrt $ pi / 3) g
-- 
cgit v1.2.3