note description: "[ This class allows you to generate RANDOM_NUMBERs for use in other classes. ]" author: "JSO, Revised by AB" date: "Aug 8, 05" revision: "$1.0$" class interface RANDOM_NUMBER create make_real_random, make_repeatable, make_with_seed feature -- Creation make_real_random -- Create a Random Number Generator. make_repeatable -- Create a Random Number Generator with a repeatable sequence. ensure is_repeatable: seed = My_seed make_with_seed (s: INTEGER_32) -- Create a Random Number Generator with a repeatable seed. require seed_positive: s > 0 ensure seed_set: seed = s feature -- Basic Operations integer_value_between (low_limit: INTEGER_32; high_limit: INTEGER_32): INTEGER_32 -- This feature allows you to generate a random integer -- between two integers eg. 4 and 8 or 1 and 10. require low_limit >= 0 high_limit >= low_limit ensure result_within_bounds: Result >= low_limit and Result <= high_limit index_incremented: index = old index + 1 real_value_between (low_limit: INTEGER_32; high_limit: INTEGER_32): REAL_32 -- This feature allows you to generate a random real -- between two integers require low_limit >= 0 high_limit >= low_limit ensure result_within_bounds: Result >= low_limit.to_real and Result <= high_limit.to_real index_incremented: index = old index + 1 end -- class RANDOM_NUMBER
Generated by ISE EiffelStudio