skip to main content
10.1145/2364489.2364504acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
research-article

TinyMT pseudo random number generator for Erlang

Published: 14 September 2012 Publication History
  • Get Citation Alerts
  • Abstract

    This paper is a case study of implementing Tiny Mersenne Twister (TinyMT) pseudo random number generator (PRNG) for Erlang. TinyMT has a longer generation period (2127-1) than the stock implementation of Erlang/OTP random module. TinyMT can generate multiple independent number streams by choosing different generation parameters, which is suitable for parallel generation.
    Our test results of the pure Erlang implementation show the execution time of RNG generating integers with TinyMT is approximately two to six times slower of that with the stock random module. Additional implementation with Native Interface Functions (NIFs) improved the execution speed to approximately three times as faster than that of the random module. The results suggest TinyMT will be a good candidate as an alternative PRNG for Erlang, regarding the increased period of the RNG and the benefit of generating parallel independent random number streams.

    References

    [1]
    B. A. Wichmann and I. D. Hill. Algorithm AS 183: An Efficient and Portable Pseudo-Random Number Generator. Journal of the Royal Statistical Society. Series C (Applied Statistics), 31 (2): 188--190, 1982.
    [2]
    B. A. Wichmann and I. D. Hill. Correction: Algorithm AS 183: An Efficient and Portable Pseudo-Random Number Generator. Journal of the Royal Statistical Society. Series C (Applied Statistics), 33 (1): 123, 1984.
    [3]
    Ericsson, A. B. Erlang Efficiency Guide. http://www.erlang.org/doc/efficiency_guide/advanced.html.
    [4]
    M. Gebetsroither. Please add sfmt_pure.erl as tested alternative - sfmt-erlang issue#5. https://github.com/jj1bdx/sfmt-erlang/issues/5.
    [5]
    P. Gustafsson and K. Sagonas. Native code compilation of Erlang's bit syntax. In Proceedings of the 2002 ACM SIGPLAN workshop on Erlang, ERLANG '02, pages 6--15, New York, NY, USA, 2002. ACM. ISBN 1--58113--592-0. 10.1145/592849.592851. URL http://doi.acm.org/10.1145/592849.592851.
    [6]
    P. L'Ecuyer and R. Simard. TestU01: A C library for empirical testing of random number generators. ACM Trans. Math. Softw., 33 (4), Aug. 2007. ISSN 0098-3500. 10.1145/1268776.1268777. URL http://doi.acm.org/10.1145/1268776.1268777.
    [7]
    D. Luna, M. Pettersson, and K. Sagonas. HiPE on AMD64. In Proceedings of the 2004 ACM SIGPLAN workshop on Erlang, ERLANG '04, pages 38--47, New York, NY, USA, 2004. ACM. ISBN 1-58113-918-7. 10.1145/1022471.1022478. URL http://doi.acm.org/10.1145/1022471.1022478.
    [8]
    M. Matsumoto and T. Nishimura. Dynamic creation of pseudorandom number generators. In Monte Carlo and Quasi-Monte Carlo Methods 1998, pages 56--69. Springer, 2000. URL http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/ARTICLES/articles.html.
    [9]
    M. Matsumoto and T. Nishimura. Mersenne twister: a 623-dimensionally equidistributed uniform pseudo-random number generator. ACM Trans. Model. Comput. Simul., 8: 3--30, January 1998. ISSN 1049-3301. http://doi.acm.org/10.1145/272991.272995. URL http://doi.acm.org/10.1145/272991.272995.
    [10]
    M. Papadakis and K. Sagonas. A PropEr integration of types and function specifications with property-based testing. In Proceedings of the 10th ACM SIGPLAN workshop on Erlang, Erlang '11, pages 39--50, New York, NY, USA, 2011. ACM. ISBN 978-1-4503-0859-5. 10.1145/2034654.2034663. URL http://doi.acm.org/10.1145/2034654.2034663.
    [11]
    Python Software Foundation. Python Programming Language. http://www.python.org/.
    [12]
    R Development Core Team. R: A Language and Environment for Statistical Computing. R Foundation for Statistical Computing, Vienna, Austria, 2012. URL http://www.R-project.org/. ISBN 3-900051-07-0.
    [13]
    K. Rikitake. SFMT pseudo random number generator for Erlang. In Proceedings of the 10th ACM SIGPLAN workshop on Erlang, Erlang '11, pages 78--83, New York, NY, USA, 2011. ACM. ISBN 978-1-4503-0859-5. 10.1145/2034654.2034669. URL http://doi.acm.org/10.1145/2034654.2034669.
    [14]
    M. Saito and M. Matsumoto. A Variant of Mersenne Twister Suitable for Graphic Processors. CoRR, abs/1005.4973, 2010. http://arxiv.org/abs/1005.4973.
    [15]
    M. Saito and M. Matsumoto. SIMD-Oriented Fast Mersenne Twister: a 128-bit Pseudorandom Number Generator. In A. Keller, S. Heinrich, and H. Niederreiter, editors, Monte Carlo and Quasi-Monte Carlo Methods 2006, pages 607--622. Springer Berlin Heidelberg, 2008. ISBN 978-3-540-74496-2.
    [16]
    M. Saito and M. Matsumoto. A high quality pseudo random number generator with small internal state. IPSJ SIG Notes, 2011 (3): 1--6, Oct. 2011. URL http://ci.nii.ac.jp/naid/110008620834/en/.
    [17]
    M. Saito and M. Matsumoto. Tiny Mersenne Twister (TinyMT). http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/TINYMT/index.html.
    [18]
    V. Shoup. NTL: A Library for doing Number Theory. http://www.shoup.net/ntl/.
    [19]
    The Open Source Initiative. The BSD 3-Clause License. http://www.opensource.org/licenses/bsd-3-clause.
    [20]
    M. Truog. big-integers implementation of Wichmann-Hill 2006 algorithm - sfmt-erlang issue#3. https://github.com/jj1bdx/sfmt-erlang/issues/3.
    [21]
    User thomasc at GitHub. Use sfmt-erlang for random number generation - proper issue#34. https://github.com/manopapad/proper/pull/34.
    [22]
    B. A. Wichmann and I. D. Hill. Generating good pseudo-random numbers. Comput. Stat. Data Anal., 51: 1614--1622, December 2006. ISSN 0167-9473. 10.1016/j.csda.2006.05.019. URL http://portal.acm.org/citation.cfm?id=1219162.1219278.

    Cited By

    View all
    • (2024)A Lightweight and Secure Communication Protocol for the IoT EnvironmentIEEE Transactions on Dependable and Secure Computing10.1109/TDSC.2023.326797921:3(1050-1067)Online publication date: May-2024

    Recommendations

    Comments

    Information & Contributors

    Information

    Published In

    cover image ACM Conferences
    Erlang '12: Proceedings of the eleventh ACM SIGPLAN workshop on Erlang workshop
    September 2012
    88 pages
    ISBN:9781450315753
    DOI:10.1145/2364489
    • General Chair:
    • Torben Hoffman,
    • Program Chair:
    • John Hughes
    Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

    Sponsors

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Publication History

    Published: 14 September 2012

    Permissions

    Request permissions for this article.

    Check for updates

    Author Tags

    1. erlang
    2. mersenne twister
    3. pseudo random number generator
    4. tinymt

    Qualifiers

    • Research-article

    Conference

    ICFP'12
    Sponsor:

    Acceptance Rates

    Overall Acceptance Rate 51 of 68 submissions, 75%

    Upcoming Conference

    ICFP '24

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)0
    • Downloads (Last 6 weeks)0

    Other Metrics

    Citations

    Cited By

    View all
    • (2024)A Lightweight and Secure Communication Protocol for the IoT EnvironmentIEEE Transactions on Dependable and Secure Computing10.1109/TDSC.2023.326797921:3(1050-1067)Online publication date: May-2024

    View Options

    Get Access

    Login options

    View options

    PDF

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    Media

    Figures

    Other

    Tables

    Share

    Share

    Share this Publication link

    Share on social media