Advertisement
stiansjogren

rnd

May 20th, 2016
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.19 KB | None | 0 0
  1. function res = randnum()
  2.     % Generates a number from a uniform distribution in the interval -pi:pi
  3.     res = 2*pi*rand(1,1,'double') - pi;
  4.     if res == pi
  5.         res = randnum();
  6.     end
  7. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement