We've moved! Join us as we continue development on our new site at umod.org!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  1. Hey, I am not sure if that feature already exists. I checked the github and seems like it does not. Sorry if it does, feel free to close it or poke me :)

    I think it should be next to the Random and would be something like this:

    Code:
    void Shuffle(T[] data) {
          for (var i = data.Length; i > 1; i--) {
              var r = random.Next(i--);
              var t = data[r];
              this.data[r] = this.data[i];
              this.data[i] = t;
         }
      }
    This is something I use in my projects. For instance shuffeling the kits, teleporting points, giving random gifts etc..
     
  2. Wulf

    Wulf Community Admin

    Why would this need to be something Oxide provides?
     
    Shady757 likes this.
  3. Not sure myself. I see that there are some utility methods provided by Oxide (i.e. alternative random for unity), so just a thought. As a dev I would like to get most optimized shuffle algorithm (not sure mine was the best)