Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
std::discre...distribution(3) C++ Standard Libarystd::discre...distribution(3)

NAME
       std::discrete_distribution::discrete_distribution  - std::discrete_dis-
       tribution::discrete_distribution

Synopsis
	  discrete_distribution();
       (1) (since C++11)
	  template<		  class		      InputIt		     >
       (2) (since C++11)
	  discrete_distribution( InputIt first,	InputIt	last );
	  discrete_distribution(   std::initializer_list<double>   weights  );
       (3) (since C++11)
	  template< class UnaryOperation >

	  discrete_distribution(  std::size_t  count,  double	xmin,	double
       (4) (since C++11)
	  xmax,

				 UnaryOperation	unary_op );
	  explicit   discrete_distribution(   const   param_type&   params  );
       (5) (since C++11)

	  Constructs a new distribution	object.

	  1) Default constructor. Constructs the distribution  with  a	single
       weight p	= {1}.
	  This distribution will always	generate 0.
	  2)  Constructs  the  distribution  with weights in the range [first,
       last). If first ==
	  last,	the effects are	the same as of the default constructor.
	  3) Constructs	the distribution with weights in weights.  Effectively
       calls
	  discrete_distribution(weights.begin(), weights.end()).
	  4) Constructs	the distribution with count weights that are generated
       using function
	  unary_op. Each of the	weights	is equal to w
	  i = unary_op(xmin + (i + 0.5)), where	 =

	  (xmax	 xmin)
	  count

	  and  i  {0, ..., count  1}. xmin and xmax must be such that  > 0. If
       count ==	0
	  the effects are the same as of the default constructor.
	  5) Constructs	the distribution with params as	the distribution para-
       meters.

Parameters
			the range of elements defining the numbers to  use  as
       weights.	The type
	  first, last -	of the elements	referred by InputIterator must be con-
       vertible	to
			double
	  weights     -	initializer list containing the	weights
			unary operation	function object	that will be applied.

			The  signature of the function should be equivalent to
       the following:

			 Ret fun(const Type &a);
	  unary_op    -
			The signature does not need to have const &.
			The type  Type must be such that  an  object  of  type
       double can be
			dereferenced  and  then	implicitly converted to	 Type.
       The type	Ret must
			be such	that an	object of type double can be  derefer-
       enced and assigned
			a value	of type	Ret.
	  params      -	the distribution parameter set

Type requirements
	  -
	  InputIt must meet the	requirements of	LegacyInputIterator.

http://cppreference.com		  2024.06.10	 std::discre...distribution(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=std::discrete_distribution::discrete_distribution&sektion=3&manpath=FreeBSD+Ports+15.1.quarterly>

home | help