Drexel dragonThe Math ForumDonate to the Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Generate randomly between -1 and 1
Replies: 2   Last Post: Jan 29, 2013 12:32 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View  
Bruno Luong

Posts: 9,240
Registered: 7/26/08
Re: Generate randomly between -1 and 1
Posted: Jan 29, 2013 12:32 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

dpb <none@non.net> wrote in message <ke8q86$59q$1@speranza.aioe.org>...

> z=y + sign(rand(size(x))-0.5).*x;

Beaware there is a small chance that rand() returns exactly 0.5, which might create buggy code.


Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2015. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.