This week's book giveaways are in the Refactoring and Agile forums. We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line! See this thread and this one for details.
is there any way so i can generate a number always less then 255 when i am using
i need this value always be less then 255.
posted 7 years ago
Never use new Random().nextAnything(); It is not as bad as it used to be under Java 1.4, but there is a risk of getting the same number sequence again. Read the Random API documentation, and look carefully for what you quoted, namely nextInt(). You probably mean less than or equal to 255, so pass 256 not 255.