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

Alright then im doing it wrong... And im asking again now, Even if i will use a list to store them ....

Then i have to do the same thing to suffle them right?.......... :D

 

Forget about vectors.. lets say i have list ... i want just the way for a random split for 2 other lists...

You can use the 

Collections.shuffle(list)

to suffle the list.

After you add the elements onto the list use it to suffle it.

  • 0
Posted

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 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!!!

show code

  • 0
Posted (edited)

show code

What code do you need? i havent ready code that working thats why im asking for help...

 

players = 50 players

 

vec1 = 0

vec2 = 0;

 

how i can randomly split the players to vec1 & vec2.

 

Sorry for no posting my code but i think its rly useless since im looking the way for a split

Correct me if im wrong

 

Edit: Actually i havent something to show you.. i just want to create this code 

Edited by melron
  • 0
Posted (edited)

Bla bla bla, you afraid of people leeching your code? If i don't see the code you ain't take your answer.

 

Byeee  :-[

Yea u found it! 

as im saying....

Edit: Actually i havent something to show you.. i just want to create this code

 

i havent ready code to show you im just want find this way to split...

To explain it again:

 

players using the command .example

When the list 'players' collect 50 people the registration will close.

 

after that i want to split the players in these 2 vectors randomly so i can continue work with them...

i think you can understand what i mean.. i wanna start making something...

 

atm the code is here but as i said isnt showing something... You dont need these..

 

Open registrations

 

 

protected void openRegistrations()
   {  
       state = State.REGISTER;
       Broadcast.announceToOnlinePlayers(".::Event::.");
       Broadcast.announceToOnlinePlayers("In one minute registration will be close!");
       ThreadPoolManager.getInstance().scheduleGeneral(new checkRegist(), 60000 );
   } 

 

 

check registrations

Event.java

 

 

protected void Registrations()
    {
	   try
	   {
	       state=State.LOADING;
	       
	       if(players.isEmpty() || players.size() < 50)
	       {
	           Broadcast.announceToOnlinePlayers("Event aborted due to innactivity!");
	           clean();
	           return;
	       }
	       Broadcast.announceToOnlinePlayers("In 30 seconds players will shuffle");
	       ThreadPoolManager.getInstance().scheduleGeneral(new shuffle, 30000 ); 
	   }
	   catch (Exception e)
	   {
		   _log.warning("Error event" + e.getMessage());
	   }
	   
    } 

 

 

 

Say2.java

 

 

checkCommand(_text,activeChar);
		       if(_text.equalsIgnoreCase(".example") || _text.equalsIgnoreCase(".example"))
		           return;

 

 

 

checkCommand in Say2.java

 

 

static void checkCommand(String text,L2PcInstance player)
	   {
	       if(text.equalsIgnoreCase(".example"))
	       {
	           if(Event.players.contains(player))
	           {
	               player.sendMessage("You have already registed to the event.");
	               return;
	           }
	           if(Event.state == Event.State.INACTIVE)
	               return;
	           if(Event.state != Event.State.REGISTER)
	           {
	               player.sendMessage("Event has already started.");
	               return;
	           }
	           Event.players.add(player);
	           player.sendMessage("You registed to the event!!");
	           return;
	       }

 

 

 

And in shuffle i want to make this split... So??

Edited by melron
  • 0
Posted (edited)

Why the fuck you use vector ?

i updated my previous post you can take a look

Edited by melron
  • 0
Posted (edited)

I don't know why you want use vector. Probably you want create 3 teams which is bad lel. You need create teamHolders no vectors but even if you want create vectors i won't go against it.

 

Make a for to all elements of players and use a variable i and check if i > 15 to add the player into vector 1 (then do i++) else add player into vector 2

if this is what you want.

for (int i=0; i <= players.size();)
{
   if (i<=15)
      vectorplayers1.add(players.get(i));
   else
      vectorplayers2.add(players.get(i));
   i++;
}

something like this maybe? i don't even know vector i dont use it.

 

Just giving you the idea on how to split into 3 vectors

Edited by AccessDenied
  • 0
Posted (edited)

I don't know why you want use vector. Probably you want create 3 teams which is bad lel. You need create teamHolders no vectors but even if you want create vectors i won't go against it.

 

Make a for to all elements of players and use a variable i and check if i > 15 to add the player into vector 1 (then do i++) else add player into vector 2

if this is what you want.

for (int i=0; i <= players.size();)
{
   if (i<=15)
      vectorplayers1.add(players.get(i));
   else if (i>15 && i<=30)
      vectorplayers2.add(players.get(i));
   else
      vectorplayers3.add(players.get(i));
   i++;
}

something like this maybe? i don't even know vector i dont use it.

 

Just giving you the idea on how to split into 3 vectors

Thank you for your help, I want 2 teams (the players vector will be clean after the split)

im trying to use a kind of shuffle ... with your way its like the first 25 players go to team1 and the others go to team 2.. i want random selection :/

 

p.s if i can do this one with a better way i will not say no :D

 

But if i will use a list or something , I  should do the same method as im searching now... Am i wrong?

Edited by melron
  • 0
Posted

Thank you for your help, I want 2 teams (the players vector will be clean after the split)

im trying to use a kind of suffle ... with your way its like the first 25 players go to team1 and the others go to team 2.. i want random selection :/

 

p.s if i can do this one with a better way i will not say no :D

 

But if i will use a list or something , I  should do the same method as im searching now... Am i wrong?

 

Making teams don't even use vectors or arrays lel 

what if u need 5 teams u will make 5 vectors? you use sets stored into 1 array.

  • 0
Posted (edited)

Making teams don't even use vectors or arrays lel 

what if u need 5 teams u will make 5 vectors? you use sets stored into 1 array.

Alright then im doing it wrong... And im asking again now, Even if i will use a list to store them ....

Then i have to do the same thing to shuffle them right?.......... :D

 

Forget about vectors.. lets say i have list ... i want just the way for a random split for 2 other lists...

Edited by melron
  • 0
Posted

You can use the 

Collections.shuffle(list)

to suffle the list.

After you add the elements onto the list use it to suffle it.

Thank you!

Guest
This topic is now closed to further replies.


  • Posts

    • Web: https://cheatcenter.net/ Counter Strike 2 Nixware Hack With the Nixware cheat, you have powerful software in your hands for exciting battles in Counter-Strike 2! The perfect set of features for Rage and Semi-Rage games will provide you with confidence on the battlefield. Use antiaim to avoid being hit. Customize the world for yourself by adjusting the colors and the sky. Shoot through the walls and use other unique opportunities to defeat your rivals and become the leader of the team! Product Description LEGITBOT FOV Hitboxes Head Neck Chest Stomach Pelvis Smooth Shot delay Kill delay Lock target Lock mouse Draw FOV Disable when Smoke Flash Jump RAGEBOT Aimbot FOV changer Hitscan Head Neck Chest Stomach Pelvis HeadBody point scale Minimal damage Hitchance Force shoot PSilent Antiaim Autoscope Autostop (between shots) Bunnyhop Auto strafer with smooth adjustment Accurate walk ESP Box Glow Skeleton Footsteps Name Weapon name Health Health bar Ammo Chams Ragdoll chams Offscreen ESP Box Minimal and maximum radius customization Minimal and maximum size customization WORLD Bomb esp Timer Damage Name Weapons Icon Name Glow Grenades Color Trajectory Timer Grenade proximity warning SKINS Gloves Seed Paint kit Wear Knifes Seed Paint kit Wear Weapons Seed Paint kit Wear MISC View Model Editor View Model Chams Hand chams Glove chams Sleeve chams Weapon chams Auto Accept Show player money Spectator list World modulation (world, clouds, sky, sun) Spread circle TaserKnife range Hit markerHit effect Aspect ratio Third person REMOVALS Flash Smoke Visual recoil Scope borders Zoom Sniper crosshair check Team intro First person legs Model occlusion Shadows Fog Decals Particles Water effect Lightning  
    • Web: https://cheatcenter.net/ Counter Strike 2 Xone Hack Looking for a legit cheat for Counter-Strike 2? Xone is your perfect choice! Our product provides unsurpassed features that allow you to play legit and at the same time have an advantage over other players. Discover a new level of gaming efficiency with Xone! Product Description AIM Draw fov Draw target Only enemy Only visible Status Smooth Fov Hitbox Compensation Standalone Target switch Trigger Use aimbot Sticky mode Recoil compensation Delay Custom setting for all VISUAL Enable Box Skeleton Head Loot Health Weapon Name Defuser Bomb Visible check MISK Radar Only enemy Color Enemy/Team Scale Size Keybind Spectator list Bomb info  
    • Web: https://cheatcenter.net/ Apex Legends Phoenix Macro We are excited to introduce our new development, Phoenix private macros for Apex Legends. Recently, it has become harder to develop stable and undetectable cheats for Apex, so we decided to add a safer option to our range. Our macros offer a revolutionary solution in the world of Apex scripts and macros. Everything is launched and configured through a convenient menu and works with all weapons and computer mouse models. So, our program is very user-friendly. Phoenix Macros provide you with an advantage in the game while minimizing the risk of your account being banned. In addition, we offer our program at a very affordable price. If you don't want to risk using cheats, then Phoenix Macro is perfect for you! Product Description Weapon recoil control (Apex Macros) Enable - You can enable/disable the macro during the game Weapon - the choice of weapons with which the macro will work Works with all weapons in the game Scopes - works with all scopes in the game Attachments - works with all weapon mods in the game Control X / Y - adjustment of vertical and horizontal recoil Auto-detection of weapons in your arms Auto-detection of weapon modules Hipfire - macro works when you shoot from the hip (not aiming) Legit Mode - is a safer way to control recoil List of supported weapons (Script / Macros for All Weapons) R99 R301 Alternator RE45 Flatline Spitfire C.A.R. Hemlock Rampage Devotion Volt P2020 SCOUT G7 Havoc PDW L-Star w30-30 Nemesis List of supported modules for guns Double Tap Trigger Turbocharger 2x HCOG "Bruiser" 1x-2x Variable Holo 3x HCOG "Ranger" 2x-4x Variable AOG Barrel Stabilizer Laser Sight Add. Script Features (Phoenix Macro) Binds - bind keys to select the desired weapon Autodetection - automatic detection of weapons in hands when holding a key Selector Circle - a convenient window for selecting weapons (in the form of a circle / wheel) Anti OBS - hide the script window and menu on screenshots and when recording via OBS Languages - English, French, German, Italian, Polish, Portuguese (Brazilian), Russian, Spanish and Turkish Use Controller - phoenix macro for apex works with gamepads
    • Web: https://cheatcenter.net/ Apex Legends Dullwave Hack The private cheat Dullwave for Apex Legends. What sets this product apart is its balance and high quality, with a Loot ESP feature offering a wide range of settings. The primary function of the software is the AIM, specifically a vector-based system, perfect for both Legit and Semi-Rage playstyles. The next menu option is Loot. The item ESP is highly effective, with a variety of settings and categories, making it both visually appealing and user-friendly. Player ESP also matches the quality of AIM and Loot, providing a full-featured player display with smooth performance and multiple customization options. Notably, the Dullwave cheat stands out for its excellent performance and minimal risk of getting banned. If you're looking to try something new and reliable in the realm of Apex Legends cheats, Dullwave is an outstanding choice. Product Description AIM Enabled - enable aimbot, aiming assistance when shooting Bind - select a key to activate the aimbot (hold) Bone - body parts that the aimbot will target FOV - the size of the aimbot's working area Draw FOV - show the aimbot's working area as a circle around the sight Smooth - the smoothness of the aimbot, the smoother the aimbot is Prediction - predicting the enemy's trajectory Visible Check - only target enemies not behind walls Draw Snapline - draw a line to the current aimbot target Dynamic Smooth - dynamic smoothness, depending on the situation Ignore Knocked - ignore knocked enemies Max Distance - limit the range of the aim ESP (Wallhack) Max Distance - limit the range of the aim Box ESP - wh in the form of boxes Box Style - box style, corners or full 2D boxes Health Bar - show the amount of HP using a bar Armor Bar - Show the amount of armor players have using a bar Skeleton - wh in the form of skeletons Distance - distance to targets Name ESP - players' nicknames Snaplines - wh in the form of lines Weapon - weapons in the hands of players Glow - outline of character models Spectators - show the number of players who are watching you after death Loot ESP (Items) Loot ESP - wh showing items (loot) Rarity Filter - filter items based on their rarity Glow - outline of items Ammo - show ammunition Heal - first aid kits, items for treatment Scopes - sights for weapons Weapons - various weapons Deathbox - boxes of dead players with loot inside Grenades - grenade, explosive Equipment - helmets, armor, backpacks Attachments - various modules for weapons Distance - distance to loot
    • Web: https://cheatcenter.net/ Albion Online Radar Hack We are excited to introduce a new product in our store: a private radar for Albion Online. Creating software with powerful features for this game is quite challenging, which is why radar software remains one of the most useful and safest options available. With this radar, you can easily detect resources, mobs, players, and other in-game objects. The software comes with numerous customizable settings, allowing you to tailor it to your preferences. In short, if you want to significantly boost your farming and leveling speed in Albion Online, this radar is an invaluable tool you shouldn’t overlook. Product Description Players Radar for Albion Online Enable On Mount Name Health Distance Players in Your Party (Team Check) Mobs Radar for Albion Online Hostile (Enemies) Boss Miniboss Mists Wisps (Common, Uncommon, Rare, Epic, Legendary) World (Items, Loot) Wood Rock Fiber Ore Hide Filter by Tier & Enchantment Hiden Cheast Avalone Drone Player Lootbag Mob Lootbag Dungeons Solo Group Corrupt Hellgate Mist Portal Distance Misc (Other Settings) Zoom Transparency Point Scale Text Scale Disable Radar Key Disable Player Key Custom Colors CFG System      
  • Topics

×
×
  • Create New...