i have an assignment in which i have a list of lists , in which every first element of the lists inside the list are always the same, for example: [[element, ....], [element, ...], [element, ...]]. I also have a function that was given to me by the professor, that generates a random list of numbers between 0 and 9 called genRandom. The way it works is you give it an Int such as 5, and you also give it a seed and it gives you [2,6,3,6,8] (for example). What i need to do is, for example, given an Int by the user, let's use 3 for this example, it should return someting like this: [[element, genRandom 2 seed, genRandom 2 seed], [element, genRandom 2 seed, genRandom 2 seed]]. In this example everytime that genRandom 2appears it should appear 2 random numbers generated by the function.
This is my attempt so far:
gerlists :: Int -> Int -> [[Int]]
gerlists 0 _ = [[]]
gerlists _ 0 = [[]]
gerlists n c = replicate n [Reta Terra 0]
In this function I'm creating the list with the first element already defined as I show above.
addRandomN :: [[Int]] -> Int -> Int -> [[Int]]
addRandomN (x:xs) c seed = (x ++ addRandomN(genRandom 2 seed): addRandomN(c-1) (genRandom 2 seed)
This is the Function in which I'm trying to concatenate.
I'm so sorry if it's hard to understand what i'm trying to say, english isn't my main language. Thanks in advance :)