## Random Data Generation Functions 

| mask_ssn(’909-63-6922’) | mask_ssn(’abcdefghijk’) | +-------------------------+-------------------------+ | XXX-XX-6922 | XXX-XX-hijk | +-------------------------+-------------------------+ mysql> SELECT mask_ssn(’909’); +-----------------+ | mask_ssn(’909’) | +-----------------+ | NULL | +-----------------+ 

The functions in this section generate random values for different types of data. When possible, generated values have characteristics reserved for demonstration or test values, to avoid having them mistaken for legitimate data. For example, gen_rnd_us_phone()  returns a US phone number that uses the 555 area code, which is not assigned to phone numbers in actual use. Individual function descriptions describe any exceptions to this principle. 

• gen_range( lower , upper ) 

Generates a random number chosen from a specified range. 

Arguments: 

• lower : An integer that specifies the lower boundary of the range. 

• upper : An integer that specifies the upper boundary of the range, which must not be less than the lower boundary. 

Return value: 

A random integer in the range from lower  to upper , inclusive, or NULL  if the upper  argument is less than lower . 

Example: 

mysql> SELECT gen_range(100, 200), gen_range(-1000, -800); +---------------------+------------------------+ | gen_range(100, 200) | gen_range(-1000, -800) | +---------------------+------------------------+ | 177 | -917 | +---------------------+------------------------+ mysql> SELECT gen_range(1, 0); +-----------------+ | gen_range(1, 0) | +-----------------+ | NULL | +-----------------+ 

• gen_rnd_email() 

Generates a random email address in the example.com  domain. 

Arguments: 

None. 

Return value: 

A random email address as a string. 

