Tuesday, November 26, 2019

Java_Lesson(9) Random

Been looking at generating a random number from the Windows
Command Line. The number will be between 0 and 32,767 exclusive
of the latter. The seed value is tied to the computer timer, so it is
not considered a safe source of randomness for cryptographic
purposes. (I have read that if two people ask for a random within
the same second interval, they will get the same number.!!)

Below, if I ask my computer sequentially, I get two different numbers.
But as an administrator, I can generate a random that gets a double
posting easily enough...






*     *     *

In the context of Java, the random utility can produce different
varieties of numbers. Below, I reproduce the Cyan Code random integer
at work. But I could well have asked for a random double.

The integer is needed in this situation to pick an array member - which run
from 0 to 4 as members - but 1 to 5 as a sequence. Running the code again 
and again gives a different course, most of the time.







No comments: