As the title explains, I am looking to generate a series of random short values. Because there is no Random.nextShort() function, the easiest way to do what I want seems to be to cast integers to short, using:
Random rand = new Random(int seed);
(short) rand.nextInt()
However, I don't fully understand how this casting takes place, and so I cannot be sure that the resulting short values would still be random. Is this the case? Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire