Giter Site home page Giter Site logo

Comments (4)

leonfoks avatar leonfoks commented on May 24, 2024

I just confirmed this, thanks for the report! I'll see what I can come up with!

from coretran.

leonfoks avatar leonfoks commented on May 24, 2024

Okay, it seems I have an issue with my "global prng" and how that is being set. If I use a local instantiation of the Prng class, it works fine for me (see below).

Using a local instance is in my opinion preferred as it gives you access to two different generators, and the seed for reproducibility purposes. The Prng class is also thread safe if you wish to use it in parallel and you can jump the state to ensure that each core (or rank in MPI) is getting a different set of random numbers.

I will work on fixing the other approach using a global prng, so you can either switch to this class approach or wait!

Thanks again!

Program main
    ! Import modules
    Use variableKind, only: r64, i32
    use Prng_Class, only: Prng

    Implicit None

    ! Data dictionary: declare parameters

    real(r64) :: r
    real(r64), dimension(10) :: rA

    integer(i32) :: i
    integer(i32), dimension(10) :: iA

    type(Prng) :: rng

    rng = Prng(big = .true., display = .true.)

    call rng%rngUniform(r, 0.d0, 1.d0)
    write(*,*) r
    call rng%rngUniform(rA, 0.d0, 1.d0)
    write(*,*) rA

    call rng%rngNormal(r)
    write(*,*) r
    call rng%rngNormal(rA)
    write(*,*) rA

    call rng%rngInteger(i, 0, 10)
    write(*,*) i

    call rng%rngInteger(iA, 0, 10)
    write(*,*) iA
End Program

from coretran.

WangYun1995 avatar WangYun1995 commented on May 24, 2024

You are welcome. BTW, 'coretran' is so cool!

from coretran.

leonfoks avatar leonfoks commented on May 24, 2024

Thank you!!

from coretran.

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.