diff --git a/htest/Test/Ganeti/HTools/Container.hs b/htest/Test/Ganeti/HTools/Container.hs
index 4df06a735aaefa07c9fb0a0d9506b51234f4257e..5ea85f6bacc12fbbcd0f9a42f4343e54421067f5 100644
--- a/htest/Test/Ganeti/HTools/Container.hs
+++ b/htest/Test/Ganeti/HTools/Container.hs
@@ -63,7 +63,7 @@ prop_findByName =
   forAll (genNode (Just 1) Nothing) $ \node ->
   forAll (choose (1, 20)) $ \ cnt ->
   forAll (choose (0, cnt - 1)) $ \ fidx ->
-  forAll (genUniquesList (cnt * 2)) $ \ allnames ->
+  forAll (genUniquesList (cnt * 2) arbitrary) $ \ allnames ->
   forAll (arbitrary `suchThat` (`notElem` allnames)) $ \ othername ->
   let names = zip (take cnt allnames) (drop cnt allnames)
       nl = makeSmallCluster node cnt
diff --git a/htest/Test/Ganeti/HTools/Types.hs b/htest/Test/Ganeti/HTools/Types.hs
index ea53d6932e94ebdf8f4bd15b1dd854b702691eea..5dbcbe71587ca9f90c12d256b6492400ced0f051 100644
--- a/htest/Test/Ganeti/HTools/Types.hs
+++ b/htest/Test/Ganeti/HTools/Types.hs
@@ -106,7 +106,7 @@ instance Arbitrary Types.IPolicy where
     istd <- genBiggerISpec imin
     imax <- genBiggerISpec istd
     num_tmpl <- choose (0, length allDiskTemplates)
-    dts  <- genUniquesList num_tmpl
+    dts  <- genUniquesList num_tmpl arbitrary
     vcpu_ratio <- choose (1.0, maxVcpuRatio)
     spindle_ratio <- choose (1.0, maxSpindleRatio)
     return Types.IPolicy { Types.iPolicyMinSpec = imin
diff --git a/htest/Test/Ganeti/OpCodes.hs b/htest/Test/Ganeti/OpCodes.hs
index e3ed1f397e13941a6baa13c643846e4d65a80ec3..58107b2787a6eee1d200374ef970cf57bdf411fa 100644
--- a/htest/Test/Ganeti/OpCodes.hs
+++ b/htest/Test/Ganeti/OpCodes.hs
@@ -360,7 +360,7 @@ genEmptyContainer = pure . GenericContainer $ Map.fromList []
 genDiskIndices :: Gen [DiskIndex]
 genDiskIndices = do
   cnt <- choose (0, C.maxDisks)
-  genUniquesList cnt
+  genUniquesList cnt arbitrary
 
 -- | Generates a list of node names.
 genNodeNames :: Gen [String]
diff --git a/htest/Test/Ganeti/TestCommon.hs b/htest/Test/Ganeti/TestCommon.hs
index 62990499fe0b0686b5240ba1e77501fcc53a1e83..13878297740afbf91f47a5226ca21fd5035c77af 100644
--- a/htest/Test/Ganeti/TestCommon.hs
+++ b/htest/Test/Ganeti/TestCommon.hs
@@ -187,11 +187,12 @@ genFields = do
   vectorOf n genName
 
 -- | Generates a list of a given size with non-duplicate elements.
-genUniquesList :: (Eq a, Arbitrary a) => Int -> Gen [a]
-genUniquesList cnt =
-  foldM (\lst _ -> do
-           newelem <- arbitrary `suchThat` (`notElem` lst)
-           return (newelem:lst)) [] [1..cnt]
+genUniquesList :: (Eq a, Arbitrary a, Ord a) => Int -> Gen a -> Gen [a]
+genUniquesList cnt generator = do
+  set <- foldM (\set _ -> do
+                  newelem <- generator `suchThat` (`Set.notMember` set)
+                  return (Set.insert newelem set)) Set.empty [1..cnt]
+  return $ Set.toList set
 
 newtype SmallRatio = SmallRatio Double deriving Show
 instance Arbitrary SmallRatio where