CHAPTER 9
GENERAL PROGRAMMING
268
and two’s complement arithmetic. Luckily, you don’t have to do this—it’s been
done for you. It’s called
Random.nextInt(int)
. You needn’t concern yourself
with the details of how it does its job (although you can study the documentation
or the source code if you’re curious). A senior engineer with a background in
algorithms spent a good deal of time designing, implementing, and testing this
method and then showed it to several experts in the field to make sure it was right.
Then the library was beta tested, released, and used extensively by millions of
programmers for almost two decades. No flaws have yet been found in the
method, but if a flaw were to be discovered, it would be fixed in the next release.
Do'stlaringiz bilan baham: