Ignat Simonenko
05/01/2020, 11:12 AMIntArray
and Int
that will be sum of two random elements of the generated array. I had no problems with the first Arb: Arb.list(<http://Arb.int|Arb.int>()).map { it.toIntArray() }
but couldn't find a solution for the second one. Could someone advise something or I choose the wrong direction?sam
05/01/2020, 3:07 PMIgnat Simonenko
05/01/2020, 6:10 PMforAll (Arb.???) { array, sum ->
val (first, second) = twoSum.find(array, sum)
array[first] + array[second] == sum
}
I expect Arbs that will generate a random array and sum of two random unequal values from a given array, like array = [1, 2, 3, 5, 7] and sum = 9 as sum of 2 and 7, my function'll return [1, 4] indices thensam
05/01/2020, 6:39 PMIgnat Simonenko
05/01/2020, 7:35 PM