That generates a single rand-stream and then takes various amounts
from it in your 'map'. To get a new random sequence each time, you'd
have to move the definition of rand-stream into your 'map' fn so that
each item of the map gets its own random stream.
Here's one way to do that:
(defn generate-data [size maxlength]
(for [i (range size)]
(apply str (take (rand-int maxlength)
(repeatedly #(char (+ (int \a) (rand-int 26))))))))
But since this is returning a lazy stream (as your original did),
there's not much value in passing in the size:
(defn seq-of-rand-strings [maxlength]
(repeatedly (fn []
(apply str (take (rand-int maxlength)
(repeatedly #(char (+ (int \a) (rand-int 26)))))))))
user=> (take 3 (seq-of-rand-strings 10))
("kae" "xwuwyp" "xa")
--Chouser