indexing description: "Generate session ids." author: "Patrick Ruckstuhl " date: "$Date$" revision: "$Revision$" class SESSION_ID_GENERATOR create make feature {NONE} -- Initialization make is -- Creation procedure local seed: INTEGER do create date.make_now seed := date.day * date.second + date.hour * date.minute create random.set_seed (seed) end feature -- Access generate_id: STRING is -- Generate a session id. do Result := generate_random_value end feature {NONE} -- Implementation random: RANDOM -- Random number generator for token generation date: DATE_TIME -- Date generate_random_value: STRING is -- Generate token value composed by 32 random letters local i: INTEGER random_string: STRING val: INTEGER do create random_string.make_empty from i := 1 until i > 32 loop random.forth val := random.item \\ 25 + 65 random_string.append_character (val.to_character_8) i := i + 1 end Result := random_string ensure result_not_void: Result /= Void end end