OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libstdc++-v3/] [testsuite/] [26_numerics/] [random/] [negative_binomial_distribution/] [operators/] [values.cc] - Blame information for rev 742

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 742 jeremybenn
// { dg-options "-std=gnu++0x" }
2
// { dg-require-cstdint "" }
3
// { dg-require-cmath "" }
4
//
5
// Copyright (C) 2011 Free Software Foundation, Inc.
6
//
7
// This file is part of the GNU ISO C++ Library.  This library is free
8
// software; you can redistribute it and/or modify it under the
9
// terms of the GNU General Public License as published by the
10
// Free Software Foundation; either version 3, or (at your option)
11
// any later version.
12
//
13
// This library is distributed in the hope that it will be useful,
14
// but WITHOUT ANY WARRANTY; without even the implied warranty of
15
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
// GNU General Public License for more details.
17
//
18
// You should have received a copy of the GNU General Public License along
19
// with this library; see the file COPYING3.  If not see
20
// <http://www.gnu.org/licenses/>.
21
 
22
// 26.5.8.3.4 Class template negative_binomial_distribution
23
// [rand.dist.bern.negbin]
24
 
25
#include <random>
26
#include <functional>
27
#include <testsuite_random.h>
28
 
29
void test01()
30
{
31
  using namespace __gnu_test;
32
 
33
  std::mt19937 eng;
34
 
35
  std::negative_binomial_distribution<> nbd1(5, 0.3);
36
  auto bnbd1 = std::bind(nbd1, eng);
37
  testDiscreteDist(bnbd1, [](int n)
38
                   { return negative_binomial_pdf(n, 5, 0.3); } );
39
 
40
  std::negative_binomial_distribution<> nbd2(55, 0.3);
41
  auto bnbd2 = std::bind(nbd2, eng);
42
  testDiscreteDist(bnbd2, [](int n)
43
                   { return negative_binomial_pdf(n, 55, 0.3); } );
44
 
45
  std::negative_binomial_distribution<> nbd3(10, 0.75);
46
  auto bnbd3 = std::bind(nbd3, eng);
47
  testDiscreteDist(bnbd3, [](int n)
48
                   { return negative_binomial_pdf(n, 10, 0.75); } );
49
}
50
 
51
int main()
52
{
53
  test01();
54
  return 0;
55
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.