Shuffle

Onkel Rikki
Onkel Rikki Member Posts: 3 Newcomer
edited October 22 in Reaktor

How would I shuffle a set of integers? For example, you have set of hundred integers in ascending order: 1, 2, 3, 4, 5, 6, ... 100. The goal is shuffle this set into a random order with all 100 integers present, every integer just once. Hopefully there's a macro somewhere!

Comments

  • colB
    colB Member Posts: 988 Guru

    https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle

    There was a long thread on the old forum. Pretty sure I uploaded a Fisher-Yates implementation. Might still be up on waybackmachine.

  • Onkel Rikki
    Onkel Rikki Member Posts: 3 Newcomer

    Fisher-Yates seems the way to go. It's easy to do it with code, but probably not in Reaktor.

    Any idea when your Shuffle was in the forum? If I can't find it, would you be up for redoing it?

  • colB
    colB Member Posts: 988 Guru

    heh, I wouldn't be redoing it, but I did find a version. Doesn't have all the bells and whistles, but it seems legit and has sum test code around it to demonstrate the functionality… from 2010… lol

  • Onkel Rikki
    Onkel Rikki Member Posts: 3 Newcomer

    Yay! Thanks for the shuffle and all your delightful deep ensembles, I've been a fan for many years.

  • dreason85
    dreason85 Member Posts: 49 Member
    I don't think implementing Shuffle with Reaktor is a difficult task. You can do it by constantly swapping the positions of values in an array, but I think the difficulty lies in dealing with a series of discontinuous numbers. We can use the Iteration module to generate a series of continuous numbers, and of course, you can also use the Randomizer module to randomly generate a series of discontinuous integers. However, please remember that there will definitely be duplicates in the generated integers. If you want to customize these integers and then do Shuffle, I think combining Event Table and Core Cell is the most effective attempt.

    Here, I have provided you with a Shuffle for consecutive numbers.

This discussion has been closed.
Back To Top