MCPcopy Create free account
hub / github.com/Berkeley-CS61B/skeleton-sp23 / RandomInputSource

Class RandomInputSource

proj3/byow/InputDemo/RandomInputSource.java:10–25  ·  view source on GitHub ↗

Created by hug.

Source from the content-addressed store, hash-verified

8 * Created by hug.
9 */
10public class RandomInputSource implements InputSource {
11 Random r;
12
13 public RandomInputSource(Long seed) {
14 r = new Random(seed);
15 }
16
17 /** Returns a random letter between a and z.*/
18 public char getNextKey() {
19 return (char) (r.nextInt(26) + 'A');
20 }
21
22 public boolean possibleNextInput() {
23 return true;
24 }
25}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected