Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Int type always overflows when learning java random access.
Int type always overflows when learning java random access.
You use random random1= new random (100);

This 100 represents a random seed number, that is, a seed number given by a random algorithm has a certain relationship with the final random number, but it does not mean that the random number is 0 to 100, and the parameter in your random number is 1. Nextint () can represent a random interval. If no value is given, the interval of all int values is about plus or minus 265,438+billion, so it is normal to have negative numbers.