NB5 Docs► Reference Section► Binding Functions▼ pre-made functions 🖺

Functions in this category are meant to provide easy grab-and-go functions that are tailored for real-world simulation. This library will grow over time. These functions are often built directly on top of other functions in the core libraries. However, they are provided here for simplicity in workload construction. They perform exactly the same as their longer-form equivalents.

Cities

Return a valid city name.

CitiesByDensity

Return a city name, weighted by population density.

CitiesByPopulation

Return a city name, weighted by total population.

Counties

Return a valid county name.

CountiesByDensity

Return a county name weighted by population density.

CountiesByPopulation

Return a county name weighted by total population.

CountryCodes

Return a valid country code.

CountryNames

Return a valid country name.

DoubleVectors

This is a version of the NoSQLBench {@link io.nosqlbench.virtdata.library.basics.shared.util.Combiner} which is especially suited to constructing unique sequences of doubles. This can be to create arbitrarily long vectors in double[] form, where each vector corresponds to a specific character encoding. Based on the maximum cardinality of symbol values in each position, a step function on the unit interval is created for you and used as a source of magnitudes.

For example, with a combiner spec of "{@code a-yA-Y*1024}", the "{@code }a-yA-Y" part creates a character set mapping for 50 distinct indexed character values with the letter acting as a code, and then the "{@code *1024}" repeats ths mapping over 1024 digits of values, which are then concatenated into an array of values as a uniquely encoded vector. In actuality, the internal model is computed separately from the character encoding, so is efficient, although the character encoding can be used to uniquely identify each vector.

Note that as with other combiner forms, you can specify a different cardinality for each position, although the automatically computed step function for unit-interval will be based on the largest cardinality. It is not computed separately for each position. Thus, a specifier like "{@code a-z*5;0-9*2}" will only see the last two positions using a fraction of the possible magnitudes, as the a-z element has the most steps at 26 between 0.0 and 1.0.

FirstNames

Return a pseudo-randomly sampled first name from the last US census data on first names occurring more than 100 times. Both male and female names are combined in this function.

FullNames

Combines the FirstNames and LastNames functions into one that simply concatenates them with a space between. This function is a shorthand equivalent of {@code Template('{} {}', FirstNames(), LastNames())}

LastNames

Return a pseudo-randomly sampled last name from the last US census data on last names occurring more than 100 times.

NumberNameToString

Provides the spelled-out name of a number. For example, an input of 7 would yield "seven". An input of 4234 yields the value "four thousand thirty four". The maximum value is limited at 999,999,999.

StateCodes

Return a valid state code. (abbreviation)

StateCodesByDensity

Return a state code (abbreviation), weighted by population density.

StateCodesByPopulation

Return a state code (abbreviation), weighted by population.

StateNames

Return a valid state name.

StateNamesByDensity

Return a state name, weighted by population density.

StateNamesByPopulation

Return a state name, weighted by total population.

TimeZones

Return a state name, weighted by population density.

TimeZonesByDensity

Return a state name, weighted by population density.

TimeZonesByPopulation

Return a state name, weighted by population.

ToMD5ByteBuffer

Converts the byte image of the input long to a MD5 digest in ByteBuffer form. Deprecated usage due to unsafe MD5 digest. Replaced with DigestToByteBuffer with MD5 when absolutely needed for existing NB tests. However, stronger encryption algorithms (e.g. SHA-256) are recommended due to MD5's limitations.

ZipCodes

Return a valid zip code.

ZipCodesByDensity

Return a zip code, weighted by population density.

ZipCodesByPopulation

Return a zip code, weighted by population.

Back to top