Jump to content
  • 0

Best Way For Randomly Split


Question

Posted (edited)

Hello guys!

 

Im trying to find the best way to split 3 Vectors...

 

example:

public static Vector<L2PcInstance> players = new Vector<>();

Contains 50 players.

 

I want to split them to 25 - 25 but not taking 1 by 1 .. i want randomly selection in the next 2 vectors

public static Vector<L2PcInstance> vec1 = new Vector<>();
public static Vector<L2PcInstance> vec2 = new Vector<>();

Im always missing something and the result isnt correct. Someone can help me? 

Thank you!!!

Edited by melron

Recommended Posts

  • 0
Posted (edited)

Collections.shuffle(list) then use list.subList(.

 

I personally use list.subList for all paging systems.

Yea i found it thank you guys! :-*

Edited by melron
  • 0
Posted

Yea i found it thank you guys! :-*

Don't send kisses on tryskell, it turn him on and we all know what happen when a french wannabe programmer who need 9 months for 1 revision gets on :*  :-[  :-[  :-[

  • 0
Posted

Don't send kisses on tryskell, it turn him on and we all know what happen when a french wannabe programmer who need 9 months for 1 revision gets on :*  :-[  :-[  :-[

 

You're jealous.

Guest
This topic is now closed to further replies.


×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..