User Guide > Data Generation Techniques and Parameters > Random Generation
  

Random Generation

A random generation rule is a global or ad hoc rule that creates random string, numeric, and date values. You can use random generation to generate data such as salary and birth dates.
When you configure random generation, you can specify a minimum and maximum length for data strings and a minimum and maximum value for numeric data. You can include a regular expression to create a fixed percentage of the generated data. The percentages of the pattern distributions must total 100. When you generate dates, you can select a start date and end date to create random dates within a range.
Random generation rules can be global rules or ad hoc rules.
The following image shows the random generation parameters:
The random generation parameters are minimum length, maximum length, pattern, distribution percent, generate unique values, null values, and invalid values.

Random Generation Example

You want to generate addresses for customers. You create a rule that uses the random technique and the string data type. You define a regular expression in the rule. The regular expression creates rows with a four digit number, a random string of 12 characters, and "St." or "Ave." You set the pattern percentage to 100 to generate all the rows with the regular expression.

Date Random Generation Parameters

Create a random data generation rule for date data types.
The following table describes the parameters that you can configure to generate random data for date data types:
Parameter
Description
Start Date/Time
The date and time at which you can start to generate random dates.
End Date/Time
The date and time at which you can stop to generate random dates.
Exclude
The days of the week that you do not want to include in the generated dates. You can enter up to two days, and both the days cannot be same.
Null Values
A list of global rules or default rule that are available for the date data type. A null value is a value that a default rule or a global rule generates in the target column for the date data type.
Invalid Values
A list of global rules or default rule that you can select for the date data type. Any value that is less than the minimum or more than the maximum for a specified date range is not valid. Any date that falls on excluded dates is not valid.

String Random Generation Parameters

Create a random data generation rule for string datatypes.
The following table describes the parameters that you can configure to generate random data for string datatype:
Parameter
Description
Random
A range provided to generate random data. You can select Random to specify the range of the string for data generation.
Minimum Length
The minimum length for the string datatype. Default is 1.
Maximum Length
The maximum length for the string datatype. Default is the maximum value that the column permits.
From Regular Expression
A regular expression to generation random data. You can select From Regular Expression to create fixed percentage of data for generation.
Pattern
A regular expression that describes the format of generated data.
Distribution
The percentage of rows with the regular expression data. If you want to use more expressions, you can add more rows.
Generate Unique Values
Generates unique data values. You cannot generate unique values when you select From Regular Expression.
Null Values
A list of global rules or default rule that are available for the string datatype. A null value is a value that a default rule or a global rule generates in the target columns for the string datatype.
Invalid Values
A list of global rules or default rule that you can select for the string datatype. Any value that is less than the minimum length or more than maximum length for a specified range is not valid. A string that does not match the specified pattern is not valid.
You cannot generate values that are not valid when you select From Regular Expression.

Numeric Random Generation Parameters

Create random data generation rule for numeric datatypes.
The following table describes the parameters that you can configure to generate random data for numeric datatype:
Parameter
Description
Random
A rule to generate random data. You can select Random to specify the range of numeric values for data generation.
Minimum Value
The minimum value for the numeric datatype. Default is 0.
Maximum Value
The maximum value for the numeric datatype. Default is the maximum value that the column permits.
From Regular Expression
A regular expression to generation random data. You can select From Regular Expression to create fixed percentage of data for generation.
Pattern
A regular expression that describes the format of generated data.
Distribution
The percentage of rows with the regular expression data. If you want to use more expressions, you can add more rows.
Generate Unique Values
Generates unique data values. You cannot generate unique values when you select From Regular Expression.
Null Values
A list of global rules or default rule that are available for the numeric datatype. A null value is a value that a default rule or a global rule generates in the target for the numeric datatype.
Invalid Values
A list of global rules or default rule that you can select for the numeric datatype. Any value that is less than the minimum or more than the maximum for a specified range is not valid. A value that does not match the specified pattern is not valid.
You cannot generate values that are not valid when you select From Regular Expression.

Data Patterns for Random Generation

You can enter data patterns from regular expressions to generate string and numeric data.
To generate numbers that contain special characters or any other operators, you use random string data generation technique. You can use the following operators to generate string data patterns: . , \d , \w, (opt1| opt2|…..), {} , [].
To generate numbers that do not contain special characters or any other operators, you use random numeric data generation technique. To generate numeric data, you can combine the following patterns: \d, alternates (1|2|3|…), and [0-9]. You cannot nest the alternates.
When you enter data patterns to generate the credit card number, Social Security number, and Social Insurance numbers, the generated data might not be valid. These numbers follow certain algorithms and you cannot use data patterns to generate valid numbers.

String Data Pattern Examples

You want to generate email addresses, credit card numbers, phone numbers, Social Insurance numbers, Social Security numbers, dates, IP addresses, and employee IDs from regular expressions.

Email Address

To generate email addresses, you must enter the pattern in the following order:
  1. 1. Enter the first eight characters as lowercase alphabet characters [a-z].
  2. 2. Enter the sign (@).
  3. 3. Enter hotmail, yahoo, gmail, aol, or Comcast.
  4. 4. Enter .com, co.uk, or .net.
To generate an email address, use the following pattern: [a-z]{8}@(hotmail|yahoo|gmail|aol|Comcast)\.(com|co\.uk|net). To generate a data pattern for uppercase and lower alphabet characters, you can enter ([a-z]|[A-Z]){8}@(gmail|hotmail)\\.(com|co\\.uk).

Credit Card Number

To generate a credit card number, you enter the first character and the pattern.
The following table shows the output for sample patterns that generate credit card numbers:
Pattern
Sample Output
4\d{3}-\d{4}-\d{4}-\d{4}
4312-0036-5436-0876
3\d{4} \d{4} \d{6}
3852 0000 023237

Phone Number

The following table shows the output for sample patterns that generate phone numbers:
Pattern
Sample Output
\d{3}\.\d{3}\.\d{4}
617.555.1212
\d{3}-\d{3}-\d{4}
617-555-1212
\(\d{3}\) \d{3}-\d{4}
(617) 555-1212
\+\d\.\d{3}\.\d{3}\.\d{4}
+1.617.555.1212
\d\.\d{3}\.\d{3}\.\d{4}
1.617.555.1212

Social Insurance Number

The following table shows the output for sample patterns that generate Social Insurance numbers:
Pattern
Sample Output
\d{3}-\d{3}-\d{3}
289-645-236
\d{3}\.\d{3}\.\d{3}
289.645.236
\d{3} \d{3} \d{3}
289 645 236

Social Security Number

The following table shows the output for a sample pattern that generates a sample Social Security number:
Pattern
Sample Output
\d{3}-\d{2}-\d{4}
999-99-9999

Date

The following table shows the output for sample patterns that generate dates:
Pattern
Sample Output
(1|3|5|7|8|10|12)-([1-9]|[12][0-9]|30|31)-(200[0-9]|201[0-3])
5-30-2013
(4|6|9|11)-([1-9]|[12][0-9]|30)-(200[0-9]|201[0-3])
11-22-2012
(0[1-9]|1[0-2])\/((0[1-9]|2\d)|3[0-1])\/(19\d\d|200[0-3])
12/31/2003

IP Address

The following table shows the output for sample patterns that generate IP addresses:
Pattern
Sample Output
([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])
255.255.0.0
(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])
192.168.0.1

Employee ID

The following table shows the output for sample patterns that generate employee IDs:
Pattern
Sample Output
([A-Z][a-z]{2}_\d+)
Idd_1111
([A-Z][A-Z]-\d\d\d\d)
ID-4321

Numeric Data Pattern Examples

You want to generate credit card numbers, phone numbers, Social Insurance numbers, and Social Security numbers from regular expressions.
To generate a 10-digit phone number, consider the following scenarios:
The following table shows the sample output for the patterns that you can enter:
Example
Pattern
Credit card number
You enter the pattern as 5\d{15} to generate a sample output as 5312003654360876.
Phone number
You enter the pattern as \d{10} to generate a sample output as 6175551212.
Social Insurance number
You enter the pattern as \d{9} to generate a sample output as 289645236.
Social Security number
You enter the pattern as \d{9} to generate a sample output as 999999999.