possible lossy conversion from long to int?
That’s because a long is 64 bits and an int is 32 bits, not to mention you’re going from floating-point to integer. To go from long to int, you’re going … Read more
That’s because a long is 64 bits and an int is 32 bits, not to mention you’re going from floating-point to integer. To go from long to int, you’re going … Read more
You could use e.g. r.nextInt(101) For a more generic “in between two numbers” use: Random r = new Random(); int low = 10; int … Read more
Using Collections to shuffle an array of primitive types is a bit of an overkill… It is simple enough to implement the function … Read more
Here you can use my method for generating Random String protected String getSaltString() { String SALTCHARS = “ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890”; StringBuilder salt = new StringBuilder(); … Read more
The simplest way would be to create a list of the possible numbers (1..20 or whatever) and then shuffle them with Collections.shuffle. Then … Read more
Generate a random double in a range
You could use boolean values of 0 or 1 based on value of Math.random() as a double between 0.0 and 1.0 and make the random … Read more