vha_mt19937.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. A C-program for MT19937, with initialization improved 2002/1/26.
  3. Coded by Takuji Nishimura and Makoto Matsumoto.
  4. Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
  5. All rights reserved.
  6. Copyright (C) 2005, Mutsuo Saito
  7. All rights reserved.
  8. Redistribution and use in source and binary forms, with or without
  9. modification, are permitted provided that the following conditions
  10. are met:
  11. 1. Redistributions of source code must retain the above copyright
  12. notice, this list of conditions and the following disclaimer.
  13. 2. Redistributions in binary form must reproduce the above copyright
  14. notice, this list of conditions and the following disclaimer in the
  15. documentation and/or other materials provided with the distribution.
  16. 3. The names of its contributors may not be used to endorse or promote
  17. products derived from this software without specific prior written
  18. permission.
  19. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  20. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  21. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  22. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  23. CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  24. EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  25. PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  26. PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  27. LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  28. NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  29. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  30. Any feedback is very welcome.
  31. http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html
  32. email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space)
  33. Original code available at:
  34. http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/emt19937ar.html
  35. */
  36. /*
  37. *****************************************************************************
  38. * Copyright (c) Imagination Technologies Ltd.
  39. *
  40. * The contents of this file are subject to the MIT license as set out below.
  41. *
  42. * Permission is hereby granted, free of charge, to any person obtaining a
  43. * copy of this software and associated documentation files (the "Software"),
  44. * to deal in the Software without restriction, including without limitation
  45. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  46. * and/or sell copies of the Software, and to permit persons to whom the
  47. * Software is furnished to do so, subject to the following conditions:
  48. *
  49. * The above copyright notice and this permission notice shall be included in
  50. * all copies or substantial portions of the Software.
  51. *
  52. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  53. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  54. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  55. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  56. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  57. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  58. * THE SOFTWARE.
  59. *
  60. * Alternatively, the contents of this file may be used under the terms of the
  61. * GNU General Public License Version 2 ("GPL")in which case the provisions of
  62. * GPL are applicable instead of those above.
  63. *
  64. * If you wish to allow use of your version of this file only under the terms
  65. * of GPL, and not to allow others to use your version of this file under the
  66. * terms of the MIT license, indicate your decision by deleting the provisions
  67. * above and replace them with the notice and other provisions required by GPL
  68. * as set out in the file called "GPLHEADER" included in this distribution. If
  69. * you do not delete the provisions above, a recipient may use your version of
  70. * this file under the terms of either the MIT license or GPL.
  71. *
  72. * This License is also included in this distribution in the file called
  73. * "MIT_COPYING".
  74. *
  75. *****************************************************************************/
  76. #include <linux/types.h>
  77. int vha_mt19937_init(uint32_t seed, void **handle);
  78. int vha_mt19937_deinit(void *handle);
  79. int vha_mt19937_gen_uint32(void *handle, uint32_t *rand_val);
  80. int vha_mt19937_gen_range(void *handle, uint32_t min, uint32_t max, uint32_t *rand_val);