Csound Csound-dev Csound-tekno Search About

Re: Random, old and new

Date1998-11-13 23:27
FromMichael Gogins
SubjectRe: Random, old and new
I have strong feelings about random variables in code.

I recommend as strongly as I can that random variables be truly independent.
This means all "random" variables should be based on one single underlying
pseudo-random variable (linear congruential operator, usually). In C++
terms, this would mean that all random variable objects contain a single
static instance of a linear congruential operator or other pseudo-random
variable.

As for seeding, the underlying operator should seed itself from the time
when the library is initialized. After that, it should have a call so that
the user can reseed it.

You can imagine what would happen if two random variables with separate
operators were each used to produce their own streams of notes. If the user
reseeded the supposedly independent variables with the same seed before use,
they would generate identical streams of notes. Hardly random!

I feel that if users have come to depend upon the variable producing a
certain sequence, it is hardly something that could be called "random". It
is always possible to code one's own linear congruential operator if such a
predictable sequence is desired; the algorithm is simple.

-----Original Message-----
From: jpff@maths.bath.ac.uk 
To: csound@maths.ex.ac.uk 
Date: Friday, November 13, 1998 8:25 AM
Subject: Random, old and new


>Message written at 13 Nov 1998 11:44:56 +0000
>
>If the need to preserve old orchestras and the need to provide clear
>service to newcommers are both to be accommodated, then it woudl be
>possible to have a command-line option or environment variable to
>select old or new.  A little more messy internally but doable.
>
>As it has been brought up, are there any strong feelings about
>converting all the newer noise opcodes to be self contained and
>indepenent?  I see some dangers in this as it may lead to each note
>repeating the same numbers.  I think it would be possible to arrange a
>tri-state for seeding; (1) take this seed (2) use last value (3) creat
>from clock or somewhere
>
>Just musing; this change would break my chapter in the book.
>==John ffitch