[#absl-discrete_distribution-2constructor-03]
= xref:absl.adoc[absl]::xref:absl/discrete_distribution.adoc[discrete&lowbar;distribution]::discrete&lowbar;distribution
:relfileprefix: ../../
:mrdocs:

Constructors

== Synopses

Declared in `&lt;absl&sol;random&sol;discrete&lowbar;distribution&period;h&gt;`

Constructs a distribution with a single, certain outcome&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:absl/discrete_distribution/2constructor-05.adoc[discrete&lowbar;distribution]();
----

[.small]#xref:absl/discrete_distribution/2constructor-05.adoc[_» more&period;&period;&period;_]#

Constructs a distribution from a list of weights&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
explicit
xref:absl/discrete_distribution/2constructor-0b.adoc[discrete&lowbar;distribution](std::initializer&lowbar;list&lt;double&gt; weights);
----

[.small]#xref:absl/discrete_distribution/2constructor-0b.adoc[_» more&period;&period;&period;_]#

Constructs a distribution from the given parameter set&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
explicit
xref:absl/discrete_distribution/2constructor-0f.adoc[discrete&lowbar;distribution](xref:absl/discrete_distribution/param_type.adoc[param&lowbar;type] const& p);
----

[.small]#xref:absl/discrete_distribution/2constructor-0f.adoc[_» more&period;&period;&period;_]#

Constructs a distribution from a range of weights&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;typename InputIterator&gt;
explicit
xref:absl/discrete_distribution/2constructor-04.adoc[discrete&lowbar;distribution](
    InputIterator begin,
    InputIterator end);
----

[.small]#xref:absl/discrete_distribution/2constructor-04.adoc[_» more&period;&period;&period;_]#

Constructs a distribution by sampling a weight function&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class UnaryOperation&gt;
explicit
xref:absl/discrete_distribution/2constructor-02.adoc[discrete&lowbar;distribution](
    size&lowbar;t nw,
    double xmin,
    double xmax,
    UnaryOperation fw);
----

[.small]#xref:absl/discrete_distribution/2constructor-02.adoc[_» more&period;&period;&period;_]#

== Parameters

[cols="1,4"]
|===
| Name| Description
| *weights*
| The weights of the possible outcomes&period;
| *p*
| The parameter set&period;
| *begin*
| An iterator to the first weight&period;
| *end*
| An iterator past the last weight&period;
| *nw*
| The number of weights to generate&period;
| *xmin*
| The lower bound of the sampled interval&period;
| *xmax*
| The upper bound of the sampled interval&period;
| *fw*
| The unary weight function to sample&period;
|===


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