Migration problem..., Need help!.....

I am migrating from VC++ Managed code 2003 and 2005, but I ran into a problem with the vectors in VC++. I need the std::random_shuffle algorithm in a bad way.

Is there any such algorithm in C#



Answer this question

Migration problem..., Need help!.....

  • sseguron

    Thanks... I was thinking the same thing, but I was hoping C# had something so I wouldn't have to do any coding..... oh well!...
  • Anton Staykov

    maybe it has ... but i dont know any functions like that :(

     

    if u dont wanna code it, search for the code on google, im sure u will find some code of someone who wanted the same ;)


  • DmytroL

    Dont think there is ... but should be that hard to make your own.

    So, first of all u pass an array of values u wanna shuffle. Create a new array with the same capacity. Then just use a normal random function to get a random index of your source array.

    Copy the random indexed item from source to destination array. Remove the item from the source array (so u cannot have same item twice)

    Or just make a vc++ dll with exported function u can call from inside your c# project.

    Or use a vc++.net dll that can be linked to your c# project


  • Migration problem..., Need help!.....