Code Monkey home page Code Monkey logo

Comments (2)

soraxas avatar soraxas commented on June 16, 2024 1

Hi @bab2min thanks for your kind reply and suggestions! Yeah I figured that it will likely be not thread-safe, and I'm just mostly interested in whether constructing multiple Vmt19937_64 in different threads at approximately the same time would result in distinct random seed or not (I had tested it a bit and it seems to be ok but just wondering if it is guaranteed to work in general). I will use your recommendation of std::random_device as seed in different thread, thanks:)

from eigenrand.

bab2min avatar bab2min commented on June 16, 2024

Hi @soraxas
No, a random number generator of EigenRand is not thread-safe. You should not share the same instance across threads, but construct an instance of Vmt19937_64 for each thread.
Since the default constructor of Vmt19937_64 use a fixed default seed, you initialize them ​with different seeds if you want to produce different random number across thread. I recommend use std::random_device{}() as the seed for each thread's Vmt19937_64.

from eigenrand.

Related Issues (20)

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.