datastructure.loadbalance paquete; Importación de java.util.ArrayList; Importación java.util.List; Importación java.util.Random; / ** * <H3> netty_lecture </ H3> * <P> pesos sencillo algoritmo de enrutamiento </ p> * * @author: Myron * @date: 03/19/2020 22:09 ** / public class {MiGong . estática privada int = PESO la final 7; void main (String [] args) {public static el Random Random nuevos nuevos = ( ); ** distribución de peso analógico / Lista * / List <Integer> = new nueva lista de la ArrayList <> (); List.add (5);. . List.add (3); List.add (2); / ** se compensa el número de peso generado aleatoriamente * / int offset = random.nextInt (el peso); offsetCopy offset = int; for (int i = 0; I <list.size (); i ++) { compensar - = List.get (I); // atravesado aquí comparado; cuando el desplazamiento <0, Offset descrito aquí cae IF (offset <0) { System.out.printf ( "peso d% caer intervalo:% d -% d", offsetCopy, 0, list.get (i) + list.get (i -1)); retorno; } } }