Csound Csound-dev Csound-tekno Search About

RANDOM NUMBERS

Date1998-07-15 16:43
From"Ruston, Paul"
SubjectRANDOM NUMBERS
Could anyone recommend a simple way to generate random +1's and -1's
(whole #'s - nothing in between and no zeros)?  Maybe there's a simple
formula I could use with krnd without using if - then statements? 

Thanks as always
Paul Ruston

Date1998-07-15 21:56
FromErik Spjut
SubjectRe: RANDOM NUMBERS
At 11:43 AM -0400 7/15/98, Ruston, Paul wrote:
>Could anyone recommend a simple way to generate random +1's and -1's
>(whole #'s - nothing in between and no zeros)?  Maybe there's a simple
>formula I could use with krnd without using if - then statements?

k1 rand
k2 = 2*int(2*k1)-1

-------------------------------------------------------------------------------
Erik Spjut (rhymes with cute) - Acting Director,The Center for Design Education
and/or Associate Professor of Engineering
Harvey Mudd College, Claremont, CA 91711  USA
Erik_Spjut@hmc.edu      Ph & Voice mail (909) 607-3890      Fax (909) 621-8967