Random float
Hallo Max Users,
I wonder if you could give me a tip how to get a random float, as I could not use the object random, it is only good for integers.
Thank you!
tedor
multiply by 0.0001
or
beter still
use Ranf http://www.timara.oberlin.edu/~gnelson/maxdownloads/downloadmax.htm
Ohhh, yes I should use my brain sometimes.... I am going to see whats on the site...
thank you!
The scale object is one option to make your integer into a float.
Another is simply to do your own scale operation using multiply and
divide. You'll need float arguments for any of these to work.
On Feb 11, 2008, at 10:13 AM, tedor wrote:
>
> Hallo Max Users,
>
> I wonder if you could give me a tip how to get a random float, as I
> could not use the object random, it is only good for integers.
----
Steven M. Miller
Professor, Contemporary Music Program
College of Santa Fe
Home
SFIFEM
Atrium Sound Space
OVOS
CMP
tedor schrieb:
> I wonder if you could give me a tip how to get a random float, as I
> could not use the object random, it is only good for integers.
was it yesterday? we just had some solutions floating around here... ;-)
To contribute a bit more, the other thread inspired me to make a little
quasi gaussian random generator by summing 4 random values:
save as qgauss:
save as qgauss.help
--
Stefan Tiedje------------x-------
--_____-----------|--------------
--(_|_ ----|-----|-----()-------
-- _|_)----|-----()--------------
----------()--------www.ccmix.com
looks weird, but where can I find the qguass object to let it run?
or is one of them the object itself which then i need to copy in one of the Max/Msp folders?
thx
tedor schrieb:
> looks weird, but where can I find the qguass object to let it run?
I posted it into the message, copy the part below "save as qgauss:" till
"save as qgauss.help", paste it into an empty max window or choose past
from clipboard. Save as qgauss.mxb. then copy the part below "save as
qgauss.help" and paste from clipboard. Thats the help patch to it. Or
wait till I upload an update to my St.ools... ;-)
You can also use Peter Castines objects, which are externals as opposed
to an abstraction, they are more effective and precise... But I usually
prefer simple over correct... ;-)
Stefan
--
Stefan Tiedje------------x-------
--_____-----------|--------------
--(_|_ ----|-----|-----()-------
-- _|_)----|-----()--------------
----------()--------www.ccmix.com
Danke Stefan,
It works now, by coincidence I used the extension 'mxo' first.. it was working with that as well... it is strange... where can you use this object? As I think the "multiply by 0.0001" is easy...
how comes that you programed this object?
thx
tedor
Frankly, I would us lp.shhh from Litter Power.
It provides better resolution than multiplying random by 0.0001 or any other small fraction, as well as using a more industrial-strength algorithm for generating random values.
Lp.shhh is included in the free Litter Starter Pack. This is currently PPC-only in the Mac world, but as indicated in my recent announcement , this is not a permanent state of affairs. Windows users never had to worry about this issue, anyway.
Summing four uniformly distributed values for a pseudo-Gaussian... well, OK...
You really ought to sum at least a dozen independent uniforms to approximate a Gauss distribution. Using 12 has the advantage that you automatically get a convenient standard deviation.
However, it still not a true Gaussian distribution. The "tails" at the extreme ends are cut off. To get a real Gauss ditribution you need, by definition, to add an infinite number of uniform random values. That takes a while.-)
You might want to look at the patch implementing a Gaussian distribution in Classic Litter , which implements the Box-Muller formula. This gives a real Gaussian distribution in finite time.
Both of the above approaches still have real performance issues. The current versions of Litter Power and, even more importantly, Litter Bundle for Jitter use more advanced algorithms and will give you far more random number bang for your CPU buck.
Best,
Peter
Quote: tedor wrote on Mon, 11 February 2008 09:13
----------------------------------------------------
> I wonder if you could give me a tip how to get a random float, as I could not use the object random, it is only good for integers.
>
----------------------------------------------------
just another way:
mz
thank you all for the help,
I have got an Intel Mac, so some will not work on mine:)
There is some much about randomness, I can not believe it!
all the best!
tedor schrieb:
> how comes that you programed this object?
You just inspired me to do it... ;-)
Peter Castine schrieb:
> You really ought to sum at least a dozen independent uniforms to
> approximate a Gauss distribution. Using 12 has the advantage that you
> automatically get a convenient standard deviation.
Yes, I realised that 2 would give me a triangle and visually I couldn't
see much difference between 4 and more...
> However, it still not a true Gaussian distribution. The "tails" at
> the extreme ends are cut off.
But in practice I never want a true gaussian, I usually want it cut off...
And thanks a lot for the clarification, I just love your knowledge...
It still holds that if you want it correct, use Peters objects, but it
is helpful to create your own silly version, in the end you get all the
information missing in the Litter help... ;-)
Peter you should write a random book for Maxers, I'd buy it...
Stefan
--
Stefan Tiedje------------x-------
--_____-----------|--------------
--(_|_ ----|-----|-----()-------
-- _|_)----|-----()--------------
----------()--------www.ccmix.com