Lightweight random data generation library for Eiffel testing.
SIMPLE_RANDOMIZER provides core randomization features for generating test data without domain-specific baggage or file dependencies. It's a lean replacement for heavier randomizer libraries.
- Random Numbers: Integers, reals, booleans with range support
- Random Strings: Words, sentences, paragraphs, identifiers
- Random Characters: Letters, digits, alphanumeric
- Random Dates: Past, future, ranges
- UUID Generation: Full UUID, string, and compact formats
- Reproducible Sequences: Seed-based deterministic randomness
- Clone or download this repository
- Set the environment variable:
[System.Environment]::SetEnvironmentVariable('SIMPLE_RANDOMIZER', 'path\to\simple_randomizer', 'User')
- Add to your ECF:
<library name="simple_randomizer" location="$SIMPLE_RANDOMIZER\simple_randomizer.ecf"/>
class MY_TEST
feature
randomizer: SIMPLE_RANDOMIZER
generate_test_data
local
name: STRING
age: INTEGER
hire_date: DATE
id: STRING
do
-- Time-based seed (non-reproducible)
create randomizer.make
-- Or fixed seed for reproducible tests
-- create randomizer.make_with_seed (12345)
name := randomizer.random_word_capitalized
age := randomizer.random_integer_in_range (18 |..| 65)
hire_date := randomizer.random_date_in_past_days (365)
id := randomizer.random_uuid_compact
print ("Name: " + name + "%N")
print ("Age: " + age.out + "%N")
print ("Hired: " + hire_date.out + "%N")
print ("ID: " + id + "%N")
end
end| Feature | Description |
|---|---|
random_integer |
Random integer |
random_integer_in_range (range) |
Integer within range |
random_real |
Real between 0 and 1 |
random_real_in_range (lower, upper) |
Real within bounds |
random_boolean |
50/50 true/false |
random_boolean_weighted (percent) |
Weighted probability |
unique_integers (count, range) |
Array of unique integers |
| Feature | Description |
|---|---|
random_digit |
'0'..'9' |
random_letter_lower |
'a'..'z' |
random_letter_upper |
'A'..'Z' |
random_letter |
Any case letter |
random_alphanumeric |
Letter or digit |
random_character_from (string) |
Character from source |
| Feature | Description |
|---|---|
random_digits (length) |
String of digits |
random_letters (length) |
String of lowercase letters |
random_alphanumeric_string (length) |
Mixed string |
random_word |
Pronounceable word |
random_word_capitalized |
Capitalized word |
random_words (count) |
Space-separated words |
random_sentence |
Capitalized with period |
random_paragraph |
Multiple sentences |
random_identifier |
Code-safe identifier |
| Feature | Description |
|---|---|
random_date_in_past_days (days) |
Date within N days ago |
random_date_in_future_days (days) |
Date within N days ahead |
random_date_in_range (start, end) |
Date between bounds |
random_date_around_now (days) |
Date +/- N days from today |
| Feature | Description |
|---|---|
random_uuid |
UUID object |
random_uuid_string |
Hyphenated format (36 chars) |
random_uuid_compact |
No hyphens (32 chars) |
| Feature | Description |
|---|---|
random_item_from_array (array) |
Random array element |
random_string_from_list (list) |
Random string from array |
base- Eiffel standard librarytime- DATE and time-based seedinguuid- UUID generation
27 tests covering all functionality.
ec.exe -batch -config simple_randomizer.ecf -target simple_randomizer_tests -testsMIT License - Copyright (c) 2024-2025, Larry Rix
