Forum Discussion

jaryszek's avatar
jaryszek
Super User
2 years ago
Solved

Generate random list without duplicates

hi Guys,   I want it generate list from 1 to 13 and after that shuffle this list to get not sorted numbers. How can I do this ? Iist.number and number.roundbetween are generating duplicates...   ...
  • dufoq3's avatar
    dufoq3
    2 years ago

    I simply don't understand why - bacause you can just delete Random column after sorting... But if you don't want see that step as separate column - you can merge that steps into 1 for example: 

     

     

    let
        Source = Table.FromList({1..13}, Splitter.SplitByNothing(), type table[Numbers = Int64.Type]),
        Randomized = Table.RemoveColumns(Table.Sort(Table.AddColumn(Source, "Random", each Number.Round(Number.RandomBetween(1, 100), 0), Int64.Type),{{"Random", Order.Ascending}}),{"Random"})
    in
        Randomized