[#BloombergLP-bdlb-HashUtil-hash0-0ed]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlb.adoc[bdlb]::xref:BloombergLP/bdlb/HashUtil.adoc[HashUtil]::hash0
:relfileprefix: ../../../
:mrdocs:

Return a modular hash value for the specified `string` of the specified `stringLength`&period;

== Synopsis

Declared in `&lt;bdlb&lowbar;hashutil&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
unsigned int
hash0(
    char const* string,
    int stringLength,
    int modulus);
----

== Description

Return a pseudo&hyphen;random unsigned integer in the range from zero to one less than the specified `modulus` corresponding to the specified `string` having the specified `stringLength`&period; `string` need not be null&hyphen;terminated and may contain embedded null characters&period; The behavior is undefined unless `0 &lt;&equals; stringLength` and `0 &lt; modulus &lt; 2&circ;31`&period; Note that `modulus` is expected to be a prime not close to an integral power of 2&period; Also note that specifying a `modulus` of 1 will cause 0 to be returned for every `string`&period;

== Return Value

modular hash value for `string` in `&lsqb;0 &period;&period; modulus)&rsqb;`

== Parameters

[cols="1,4"]
|===
| Name| Description
| *string*
| character sequence to hash (need not be null&hyphen;terminated)
| *stringLength*
| length of `string` in bytes
| *modulus*
| positive upper bound (exclusive) of the hash range
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
