• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC SKILL
  3. Draw random numbers from a normal distribution in an Ocean...

Stats

  • Locked Locked
  • Replies 4
  • Subscribers 144
  • Views 13757
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Draw random numbers from a normal distribution in an Ocean script

Alice92
Alice92 over 7 years ago

Hello,

I want to study the effect of the parameter variabilty of a verilogA component. I would like to draw random numbers from a normal distribution when using desVar in my Ocean script.

How could I do this?

Thank you very much for your help

  • Cancel
Parents
  • drdanmc
    drdanmc over 7 years ago

    I didn't see so much in the skill manual about generating random numbers from a normal distribution but you could use the Box-Mueller transform to get a sigma=1.0, mean=0.0 normally distributed random variable.  Then just scale by the sigma you want and offset by the mean you want.

    procedure( MYrandNorm() 
    let((w, u1, u2, x1, x2)
    w = 2.0
    while( w >= 1.0

    ;; what we really want here is something uniformly distributed on [0,1]

    u1=1.0*random(m.MAX_INT) / m.MAX_INT

    u2=1.0*random(m.MAX_INT) / m.MAX_INT

    x1 = 2.0 * u1 - 1.0

    x2 = 2.0 * u2 - 1.0
    w = x1*x1 + x2*x2
    )
    w = sqrt( (-2.0 * log(w) ) / w)
    y1 = x1*w
    y2 = x2*w

    ) ; ** let **
    )

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • drdanmc
    drdanmc over 7 years ago

    I didn't see so much in the skill manual about generating random numbers from a normal distribution but you could use the Box-Mueller transform to get a sigma=1.0, mean=0.0 normally distributed random variable.  Then just scale by the sigma you want and offset by the mean you want.

    procedure( MYrandNorm() 
    let((w, u1, u2, x1, x2)
    w = 2.0
    while( w >= 1.0

    ;; what we really want here is something uniformly distributed on [0,1]

    u1=1.0*random(m.MAX_INT) / m.MAX_INT

    u2=1.0*random(m.MAX_INT) / m.MAX_INT

    x1 = 2.0 * u1 - 1.0

    x2 = 2.0 * u2 - 1.0
    w = x1*x1 + x2*x2
    )
    w = sqrt( (-2.0 * log(w) ) / w)
    y1 = x1*w
    y2 = x2*w

    ) ; ** let **
    )

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
No Data

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information