Randomly sort

Hello,

I have a question,

How do I randomly sort the numbers from 1 to 5?

For example, 3 5 1 4 2, 1 3 5 4 2, 2 5 3 1 4 and so on ,

1 Like

Read the question wrong, my bad.

@111132 How are the Numbers Stored?

Dim r As New List(Of Integer)
Dim rg As New Random
Dim rn As Integer

    Do
        rn = rg.Next(1, 5)
        If Not r.Contains(rn) Then
            r.Add(rn)
        End If
    Loop Until r.Count = 5

Hey, @111132

Assuming the numbers are stored in an array:RandomSortArray.xaml (9.1 KB)

1 Like

Thank you very much.

Your response is right for me.

Thank you for your reply.

I have an additional question.

My final goal was to sort the Excel sheets randomly like as below jpg.

I also have difficulty trying to make it with your primary reply.

How can I implement it?

If I express more precisely,

My job to do everyday are AAA, BBB, CCC, DDD, EEE.

And I want to do it in randomly order every day.

I have made XAML using ues your advice.

But If there are many jobs, My method is not good.
Do you have better method?

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