This preview shows page 1. Sign up to view the full content.
Unformatted text preview: cess numerical data and characters.
You have seen many examples that involve numerical
data. It is also important to understand characters and how
to process them.
As introduced in Section 2.9, each character has a unique
Unicode between 0 and FFFF in hexadecimal (65535 in
decimal). To generate a random character is to generate a
random integer between 0 and 65535 using the following
expression: (note that since 0 <= Math.random() < 1.0, you
have to add 1 to 65535.)
(int)(Math.random() * (65535 + 1)) Case Study: Generating Random Characters, cont.
Now let us consider ho...
View Full Document
This note was uploaded on 01/26/2012 for the course IT 108, 103, taught by Professor Bruno during the Spring '11 term at George Mason.
- Spring '11