Quantcast
Channel: Active questions tagged ocaml - Stack Overflow
Viewing all articles
Browse latest Browse all 531

How to randomly group elements of two lists and make new list of the tuples of randomly gotten new elements?

$
0
0

If I have 2 lists ['a'; 'b'] and [1;2;3;4] I want to get something like [('a',2);('a',4);('b',3); ('b', 1)]. So the point is that I need to use all elements of second list once and I can use elements from the first one 0 or more times... I tried with List.combine but is always connects nth element of 1st list with nth element of the 2nd and list need to have same length as well...


Viewing all articles
Browse latest Browse all 531

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>