- #1
Hiche
- 84
- 0
Homework Statement
Write a program that takes a positive integer N and a string as command line arguments (N is assumed to be smaller than the length of the string). The program should pick N random characters from the string and construct and print a new string composed of these random characters.
Homework Equations
for loops. random(?)
The Attempt at a Solution
We so far learned how to generate random double variables using Math.random(). Is there a way (method) to generate random characters in strings?
Code:
<method signature><method name><parameters>
for i = 0; i < some integer; i++
string.random.charAt(i); // not really a command but something as this exists?