# randomness

(further discussion of this thread https://github.com/tidalcycles/Tidal/...)

separate calls to rand (including irand, randcat, degrade, etc) during the same event(?) will produce the same results. this could be considered a bug or feature, however producing different random numbers for each call in the same event could be more interesting musically.

so consider this a request for an "impure RNG" and/or optional changes and/or discussions of the problems, merits or details of having "different" calls to a pRNG (during on event cycle) produce the same number from a random sequence or the next number from repeatable sequence of values from a given seed.

edit retag close merge delete

I'll state the obvious and point out that pseudorandomness comes down to state, and 'proper' randomness comes down to I/O. Being all about constructing pure functions of time, Tidal can't really deal with either of these at the moment.. But it'd be interesting to look for good ways around both.

( 2016-08-19 05:06:51 -0500 )edit

Sort by » oldest newest most voted

As mentioned on Slack, here's one workaround:

let rand' x = Pattern $\a -> [(a, a, timeToRand$ (+ x/100) $midPoint a)]  which defines a new function where changing x will give you different random number streams. more ## Comments sorry for asking this, but how can i do to, instead generating a "Pattern Double", generate "Pattern Int". This way would be possible to use in (not the best case) midi5$ n "0 0 ~ 0" # n (scale 48 72 $rand' 100) ( 2016-08-19 10:03:13 -0500 )edit A few ways, one is to put in a liftA floor. Like this: midi5$ n "0 0 ~ 0" # n (liftA floor $scale 48 72$ rand' 100) In general, if you've got a function that works on Doubles, you can use it on Pattern Doubles using liftA

( 2016-08-19 10:20:08 -0500 )edit

fantastic ! thanks :-)

( 2016-08-19 10:21:03 -0500 )edit

Right! i forgot about floor (...), so another way would be .... # n ((floor <$>)$ scale 48 72 $rand' 100) Either way, it doesn't produce what i expected haha ( 2016-08-19 10:24:29 -0500 )edit Yes, <$> is a synonym for fmap, and liftA is the Applicative Functor version of fmap (which is for regular Functors). How is it not what you expected? You should get a beat pattern of 0 0 ~ 0 with random notes between 48 and 72. The argument of rand' can be anything, 0.1, 1, pi...

( 2016-08-19 11:12:14 -0500 )edit

## Stats

Asked: 2016-08-19 04:38:25 -0500

Seen: 1,111 times

Last updated: Aug 19 '16