[#absl-discrete_distribution-2constructor-03] = xref:absl.adoc[absl]::xref:absl/discrete_distribution.adoc[discrete_distribution]::discrete_distribution :relfileprefix: ../../ :mrdocs: Constructors == Synopses Declared in `<absl/random/discrete_distribution.h>` Constructs a distribution with a single, certain outcome. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:absl/discrete_distribution/2constructor-05.adoc[discrete_distribution](); ---- [.small]#xref:absl/discrete_distribution/2constructor-05.adoc[_» more..._]# Constructs a distribution from a list of weights. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- explicit xref:absl/discrete_distribution/2constructor-0b.adoc[discrete_distribution](std::initializer_list<double> weights); ---- [.small]#xref:absl/discrete_distribution/2constructor-0b.adoc[_» more..._]# Constructs a distribution from the given parameter set. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- explicit xref:absl/discrete_distribution/2constructor-0f.adoc[discrete_distribution](xref:absl/discrete_distribution/param_type.adoc[param_type] const& p); ---- [.small]#xref:absl/discrete_distribution/2constructor-0f.adoc[_» more..._]# Constructs a distribution from a range of weights. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<typename InputIterator> explicit xref:absl/discrete_distribution/2constructor-04.adoc[discrete_distribution]( InputIterator begin, InputIterator end); ---- [.small]#xref:absl/discrete_distribution/2constructor-04.adoc[_» more..._]# Constructs a distribution by sampling a weight function. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class UnaryOperation> explicit xref:absl/discrete_distribution/2constructor-02.adoc[discrete_distribution]( size_t nw, double xmin, double xmax, UnaryOperation fw); ---- [.small]#xref:absl/discrete_distribution/2constructor-02.adoc[_» more..._]# == Parameters [cols="1,4"] |=== | Name| Description | *weights* | The weights of the possible outcomes. | *p* | The parameter set. | *begin* | An iterator to the first weight. | *end* | An iterator past the last weight. | *nw* | The number of weights to generate. | *xmin* | The lower bound of the sampled interval. | *xmax* | The upper bound of the sampled interval. | *fw* | The unary weight function to sample. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#