Git Product home page Git Product logo

tinymt's Introduction

TinyMT ver. 1.1.2

Tiny Mersenne Twister(TinyMT). Pseudo random number generators whose periods are 2127-1.

Mutsuo Saito (Hiroshima University) and Makoto Matsumoto (The University of Tokyo)

Copyright (C) 2011 Mutsuo Saito, Makoto Matsumoto, Hiroshima University and The University of Tokyo. All rights reserved.

The 3-clause BSD License is applied to this software, see LICENSE.txt

The documents written in English is the official one.

To see documents, make doc and then see html/index.html.

And if you are using Microsoft Visual Studio, you need to download msinttypes from google code.

If you want to redistribute and/or change source files, see LICENSE.txt.

When you change these files and redistribute them, PLEASE write your e-mail address in redistribution and write to contact YOU first if users of your changed source encounter troubles.

tinymt's People

Contributors

ax3l avatar krzikalla avatar m-mat avatar makiuchi-d avatar msaito avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tinymt's Issues

Incorrect version number?

The website says the latest release is 1.1, but the Makefile says the current version is 1.0.3.

Also, there are no tags on the repo. Any chance you could tag releases? Thanks!

Warnings: sign-conversion

With modern compilers, the lines -((int32_t)(t1 & 1)) & random->tmat in tinymt32.h/c throw warnings of the form

-((int32_t)(t1 & 1)) & random->tmat
^----------------------------------
warning: conversion to ‘uint32_t {aka unsigned int}’ from ‘int’ may change the sign of the result [-Wsign-conversion]

when compiled with -Wsign-conversion.

The same warning is probably also present in tinmy64.h/c.

Maybe an intermediate const variable and an explicit cast can solve this.

Used in: alpaka-group/alpaka#579
Diff: alpaka-group/alpaka@783b8f7

Warning: Implicit Cast uint->float

Found in alpaka-group/alpaka#994 by @krzikalla

These lines

TinyMT/tinymt/tinymt32.h

Lines 181 to 184 in 9d7ca3c

inline static float tinymt32_generate_float(tinymt32_t * random) {
tinymt32_next_state(random);
return (tinymt32_temper(random) >> 8) * TINYMT32_MUL;
}

throw a -Wconversion warning:

tinymt32.h: warning: conversion to ‘float’ from ‘uint32_t {aka unsigned int}’ may alter its value [-Wconversion]
     return (tinymt32_temper(random) >> 8) * TINYMT32_MUL;
        ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~

Possible fix via explicit cast:

 return float(tinymt32_temper(random) >> 8) * TINYMT32_MUL;

Version 1.1.2?

Because CHANGE-LOG.txt mention "ver. 1.1.2" while the README files say "ver. 1.1.1" and there is no tag "v1.1.2", I was wondering if the version 1.1.2 is an ongoing project. Or should the current codebase be considered as version 1.1.2?

To avoid possible confusion, maybe CHANGE-LOG.txt needs release date information for each version.

(By the way, there is a typo in README.md, s/TitinyMT/TinyMT/.)

STL and SYCL compatible C++ version

Hi!

I would like to humbly bring forth a feature request, namely having a C++ STL compatible version satisfying UniformRandomBitGenerator, something along the lines of std::mersenne_twister_engine.

The problem with most STL implementations is that they do not satisfy the StandardLayoutType concept, which precludes its usage in ComputeCpp, the only true, OpenCL accelerated SYCL implementation thus far. SYCL is the CUDA of OpenCL, to put it shortly, a single-source, language extension-free abstraction over OpenCL. The next best thing after ice cream. :)

ComputeCpp because is not a single-pass compiler and has to interact with other host compiler, mandates that classes used in device code be standard layout. Compilers have a limited amount of freedom in how to layout types in memory and if the host and device compilers do not agree on their layout, one will read garbled things originating from the other, hence the least common denominator is standard layout types.

I have created a stub implementation based on cppreference and started tweaking it based on MSVCs implementation and tinymt64.h. Ideally, the implementations of tinymt64 and tinymt32 should not differ. Some compile-time trickery (TMP) might be needed, but mostly flat constexpr functions. MSVCs implementation has no specializations as far as I saw, so it's fairly C code with minimal inheritance (the source of non-stanard layout) and a few static constexpr helper variables.

TinyMT.zip

I believe that someone with deep knowledge and mediocre C++ knowledge can put together this class in a fairly short amount of time. It might just be that std::mersenne_twister_engine is actually TineMT compatible, I just couldn't identify all the template params inside tinymt64.h.

Again, I would like to kindly ask for a standard layout tiny_mersenne_twister_engine implementation that satisfies UniformRandomBitGenerator to be used either with only the STL or even inside SYCL device code for parallel Monte-Carlo simulations.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.