Set randomizer per batch

I have a list of 50 names and assign “RamdomBatch = New Random().Next(8, 15)” to run 8-15 names per batch. I would like to know how to reset the RandomBatch after the 1st batch completed?

Hi @Miko ,
Have you try assign to New Random().Next(8, 15)
regards,

1 Like

Hi @Miko

Take a count variable let’s called CurrentBatchCount and initialize it with 8. Increment the CurrentBatchCount with in the loop with assign activity.

Check the below workflow for your understanding.

Assign RandomBatch = New Random().Next(8, 15)
Assign CurrentBatchCount = 8

For Each name In NameList
    // Process the name here
    
    // Increment the current batch count
    Assign CurrentBatchCount = CurrentBatchCount + 1
    
    // Check if the current batch is complete
    If CurrentBatchCount = RandomBatch
    {
        // Reset the current batch count
        Assign CurrentBatchCount = 0
        
        // Generate a new random batch size
        Assign RandomBatch = New Random().Next(8, 15)
    }
End For

Hope it helps!!

1 Like

Hi @mkankatala

It’s work!! Thank you so much!! :smiling_face:

1 Like

Thank you @Miko

Happy Automation!!

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