How to generate 25 rand numbers between 50 5000

generate 25 rand numbers between 50 5000
calc sum of odd numbers
cal sum of even numbers
print each rand num
at end
print the odd num sum
print the even num sum


You can use this to generate random numbers in a loop…if 25 is needed run loop for 25

New Random.Next(50,5000)


Hi @Anand_Designer

You can use the following procedure to achieve the same:

→ Declare an integer array variable ‘randomNumbers’ and use this expression in the Assign activity:

randomNumbers = Enumerable.Range(1, 25).Select(Function(x) New Random().Next(50, 5001)).ToArray()

You can loop through the array & determine whether the number is odd or even. Based on the nature of the number, you can eventually sum & print them.

Hope this helps,
Best Regards.

Hi @Anand_Designer

Please find the below zip file to print random even and odd numbers and sum them up.

Random (145.9 KB)

Hope it works for you!!

1 Like


Hope the following helps you.

rnd = New Random()
arrRndNumber = Enumerable.Range(0,25).Select(Function(i) rnd.Next(50,5001)).ToArray()


Sum of even numbers

arrRndNumber.Where(Function(i) i mod 2 =0).Sum()

Sum of odd numbers

arrRndNumber.Where(Function(i) i mod 2 <>0).Sum()


1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.