Difference between revisions of "rand"

From TidalCycles userbase
Jump to: navigation, search
m (Yaxu moved page Rand to rand)
 
(4 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
[[Type signature|Type]]: <syntaxhighlight lang="haskell" inline>rand :: Fractional a => Pattern a </syntaxhighlight>
 
[[Type signature|Type]]: <syntaxhighlight lang="haskell" inline>rand :: Fractional a => Pattern a </syntaxhighlight>
  
'''rand''' generates a pattern of (pseudo-)random, floating point numbers between 0 and 1.  For example to randomly pan around the stereo field you can:
+
'''rand''' is an [[Oscillators|oscillator]] that generates a pattern of (pseudo-)random, floating point numbers between 0 and 1.  For example to randomly pan around the stereo field you can:
  
 
<source>
 
<source>
Line 19: Line 19:
 
[[Type signature|Type]]: <syntaxhighlight lang="haskell" inline>irand :: Num a => Int -> Pattern a</syntaxhighlight>
 
[[Type signature|Type]]: <syntaxhighlight lang="haskell" inline>irand :: Num a => Int -> Pattern a</syntaxhighlight>
  
'''irand''' is similar to [[rand]], but generates a pattern of (pseudo-)random integers between 0 to n-1 inclusive.  Notably used to pick random samples from a folder.
+
'''irand''' is similar to [[rand]], but generates a [[Oscillators|continuous oscillator]] of (pseudo-)random integers between 0 to n-1 inclusive.  Notably used to pick random samples from a folder.
  
 
<source>
 
<source>
Line 28: Line 28:
 
[[Category:Functions]]
 
[[Category:Functions]]
 
[[Category:Randomness and chance]]
 
[[Category:Randomness and chance]]
 +
[[Category:Elemental patterns]]

Latest revision as of 23:19, 9 December 2018

Type: rand :: Fractional a => Pattern a

rand is an oscillator that generates a pattern of (pseudo-)random, floating point numbers between 0 and 1. For example to randomly pan around the stereo field you can:

d1 $ sound "bd*8" # pan rand

Or to enjoy a randomised speed from 0.5 to 1.5, you can add 0.5 to it.

d1 $ sound "arpy*4" # speed (rand + 0.5)


irand

Type: irand :: Num a => Int -> Pattern a

irand is similar to rand, but generates a continuous oscillator of (pseudo-)random integers between 0 to n-1 inclusive. Notably used to pick random samples from a folder.

d1 $ sound "amencutup*8" # n (irand 8)