Modar internal command:


 randSeed

To initiate the seed of random number generator.

  • Syntax
    randseed <iseed=?> [sys=true or false]

  • Examples

    #set the initial seed for Modar internal random number generator

    randseed iseed=31415926

     

    #set the initial seed for system random number generator

    randseed iseed=1000 sys


  • Keywords

    select=<select expr >

    The selection expression of center group

    DriftTol=<real>

    Do translation and image groups transformation whenever the drifting value of center group is over this value.


  • Variables exported
    none


  • Random number in Modar

    There are two types of pseudo-random number generator in Modar. One is using internal random number generating function, which used in MD core also, and it called “mdrand”. The other one is system random generator, called “sysrand”.

    Relevant commands:

    Randseed  seed=<number>   #to initiate random seed for internal random number generator

    Randseed  seed=<number> sys # to initiate random seed for system random number generator

     

    Relevant math functions:

    rand(maxvalue)           # to generate a random real in range [0,maxvalue]

    randsys(maxvalue)    # to generate a random real in range [0,maxvalue]

     

     

    Example scipt:  “randtest.inp”

    # file: randtest.inp

    tell pid

     

    mdrand seed=$pid     # the default seed of mdrand is 314159

    sysrand seed=1000    # the default seed of sysrand is current process ID

     

    i=rand(100)

     

    Output would be something similar to bellow: (your output may be slightly different because the process ID would be different):

    #Modar> tell pid

      new var$: pid <-- 21625

    #Modar> iseed=$pid

     load var: $pid = 21625

      new var$: iseed <-- 21625

    #Modar> randseed seed=$pid

     load var: $pid = 21625

     change MD random seed to 21625

    #Modar> randseed seed=1000 sys

     change system random seed to 1000

    #Modar> i=rand(100)

      new var$: i <-- 16.9245230191

    #Modar> j=int(randsys(1000000))

      new var$: j <-- 973136

    #Modar> echo i=$i j=$j

     load var: $i = 16.9245230191

     load var: $j = 973136

    i=16.9245230191 j=973136




 

 

 

 

 

 

 

 

  Contact us

  Phone: 400-660-8656
  Email: support@beemd.org

 

       我们长期和北京市计算中心合作提供计算培训服务,承接托管计算业务,如有需求请随时联系我们。