<%@ page import="java.util.List,java.util.ArrayList,java.util.Random" %> <% List charList; Random rand; if(session.getAttribute("charList") == null) { rand = new Random(); charList = new ArrayList(); if(request.getParameter("lowercase") != null) { for(char c = 97; c <= 122; c++) charList.add(new Character(c)); } else { for(char c = 65; c <= 90; c++) charList.add(new Character(c)); } session.setAttribute("charList",charList); session.setAttribute("rand",rand); } else { charList = (List)session.getAttribute("charList"); rand = (Random)session.getAttribute("rand"); } %>
<% if(charList.isEmpty()) { %> Done!
<% session.invalidate(); %> Play again? Capital Letters Lowercase Letters <% } else { %> <% int currRand = rand.nextInt(charList.size()); Character currChar = charList.get(currRand); charList.remove(currRand); %>
<%= currChar %>
Next <% } %>