[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-users] helpfiles




On 17 Dec 2004, at 14:11, Julian Rohrhuber wrote:

There is a new helpfile on Randomness by Alberto de Campo.

We have also improved the Routine helpfile to make it easier
to understand how yield works.

If you have comments/corrections, please go ahead.


Hey,

I have corrections ;-)

the histogram example should be something like
(
var randomNumbers, histogram, minValue, maxValue = 250, numVals = 100000, numBins = 50;

minValue = maxValue.neg;

randomNumbers = Array.fill(numVals, { maxValue.sum3rand; });
histogram = Signal.newClear(numBins);

randomNumbers.do({ arg each; var count, histoIndex;
	// rescale to numBins and cut to ints
histoIndex = ((( each - minValue )/(maxValue - minValue)) * (numBins-1)).round(1).asInteger; // catch float indices.
	count = histogram.at(histoIndex);
	histogram.put(histoIndex, count + 1)
});

histogram.plot("histogram for sum3rand " ++ minValue ++ " to " ++ maxValue ++ " in " ++ numBins ++" bins");
)

to allow arbitrary numbers of bins and to disallow the ability to take another minValue than the maxValue.neg... (which doesn't makes sense). the arbitrary number of bins may also be added to the other histogram examples... Since I do not have a dev-access to sc3, could someone please be so kind to correct this for me?

Thanx in advance
Till


and of cource a warm thank to you three JMC for sc3, Julian for JIT and AdC for this helpfile (and a lot more...)

And of course to all of you:
Happy Xmas! (Am I the first writing xmas greets here?)
I _really_ enjoy this list!