Random time not generating properly

Hello. I want to generate random minutes and seconds in the format of HH:MM:SS. I want to generate random minutes between 0 min to 1 min max. I can generate seconds normally but minutes are not working.


waitTime’s value is ‘00:" + randomMin.ToString + “:” + randomSec.ToString’
Delay’s duration value is ‘TimeSpan.Parse(waitTime)’

Output is always being ‘Random time is 00:0:35’

What am I doing wrong?

@private_matter Either you can use the activity as in the below post or you can use the below expression in an assign acitivty.

new System.Random().Next(0,60)

Modify the range as per your need.


Try as below

  1. use Assign activity and declare a variable of Int32, let say randomMin
  2. Now write as New Random().Next(0,2)


  1. Write in writeline activity as below

This will add 0 to the result

Hope this may help you


Hi @private_matter,

I hope it helps to fix the problem.

randomTime.xaml (6.2 KB)


Still not working. That’s what I get as output.


Waw!!! :grinning: You nailed it!

Works flawlessly. Exactly what I was looking for. Thank you so much @muhammedyuzuak

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