Hello list,
I want to do a simple task : pick a random float in a defined range (let's say between 0.0 and 1.0). I know there are this kind of objects in external libraries (something like [randomF] if remember), but since the collapse of Pd-Extended, I generally prefer to make vanilla abstractions.
The two solutions i foresee are :
solution #1 :
[random 1e+06] | [/ 1e+06]
but this way, it doesn't use the full floating-point resolution ?... and going over that range (like 1e_07) will result in errors (outputs 0) I guess because of floating-point complexity.
# solution #2 :
[noise~] | [snapshot~]
but this won't work if DSP/audio is turned off.
so I wondered if there are other vanilla and efficient solutions? ...or if I just have to get the external from deken... ? :)
thanks,
Raphaël
Sent from my iPhone
On May 31, 2016, at 4:44 PM, Raphaël Ilias phae.ilias@gmail.com wrote:
Hello list,
I want to do a simple task : pick a random float in a defined range (let's say between 0.0 and 1.0). I know there are this kind of objects in external libraries (something like [randomF] if remember), but since the collapse of Pd-Extended, I generally prefer to make vanilla abstractions.
The two solutions i foresee are :
solution #1 :
[random 1e+06] | [/ 1e+06]
but this way, it doesn't use the full floating-point resolution ?... and going over that range (like 1e_07) will result in errors (outputs 0) I guess because of floating-point complexity.
# solution #2 :
[noise~] | [snapshot~]
but this won't work if DSP/audio is turned off.
so I wondered if there are other vanilla and efficient solutions? ...or if I just have to get the external from deken... ? :)
thanks,
Raphaël _______________________________________________ Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
I just tried "random 1e8" and "/ 1e8" and it seems to work for me. If it doens't for you that's a bug I should look at :)
cheers Miller
On Tue, May 31, 2016 at 04:48:59PM +0200, apvague@gmail.com wrote:
Sent from my iPhone
On May 31, 2016, at 4:44 PM, Raphaël Ilias phae.ilias@gmail.com wrote:
Hello list,
I want to do a simple task : pick a random float in a defined range (let's say between 0.0 and 1.0). I know there are this kind of objects in external libraries (something like [randomF] if remember), but since the collapse of Pd-Extended, I generally prefer to make vanilla abstractions.
The two solutions i foresee are :
solution #1 :
[random 1e+06] | [/ 1e+06]
but this way, it doesn't use the full floating-point resolution ?... and going over that range (like 1e_07) will result in errors (outputs 0) I guess because of floating-point complexity.
# solution #2 :
[noise~] | [snapshot~]
but this won't work if DSP/audio is turned off.
so I wondered if there are other vanilla and efficient solutions? ...or if I just have to get the external from deken... ? :)
thanks,
Raphaël _______________________________________________ Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
Sorry my error, I tried :
random 1e+08 / 1e+08
..and it works. Don't know how I got this wrong results. It evens work until 1e+09, the precision error (that outputs 0) starts from 1e+10.
Is 1e+09 using the full decimal precision of pd's 32-bits floats ?
thanks
Raphaël
2016-05-31 17:00 GMT+02:00 Miller Puckette msp@ucsd.edu:
I just tried "random 1e8" and "/ 1e8" and it seems to work for me. If it doens't for you that's a bug I should look at :)
cheers Miller
On Tue, May 31, 2016 at 04:48:59PM +0200, apvague@gmail.com wrote:
Sent from my iPhone
On May 31, 2016, at 4:44 PM, Raphaël Ilias phae.ilias@gmail.com
wrote:
Hello list,
I want to do a simple task : pick a random float in a defined range
(let's say between 0.0 and 1.0).
I know there are this kind of objects in external libraries (something
like [randomF] if remember), but since the collapse of Pd-Extended, I generally prefer to make vanilla abstractions.
The two solutions i foresee are :
solution #1 :
[random 1e+06] | [/ 1e+06]
but this way, it doesn't use the full floating-point resolution ?...
and going over that range (like 1e_07) will result in errors (outputs 0) I guess because of floating-point complexity.
# solution #2 :
[noise~] | [snapshot~]
but this won't work if DSP/audio is turned off.
so I wondered if there are other vanilla and efficient solutions? ...or if I just have to get the external from deken... ? :)
thanks,
Raphaël _______________________________________________ Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management ->
https://lists.puredata.info/listinfo/pd-list
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management ->
On 2016-05-31 17:00, Miller Puckette wrote:
I just tried "random 1e8" and "/ 1e8" and it seems to work for me. If it doens't for you that's a bug I should look at :)
i really like the powers of the new [osc*] objects for these kind of things.
it allows me to do seemingly trivial things in complicated manners.
fgmasr IOhannes
On 05/31/2016 05:50 PM, IOhannes m zmoelnig wrote:
On 2016-05-31 17:00, Miller Puckette wrote:
I just tried "random 1e8" and "/ 1e8" and it seems to work for me. If it doens't for you that's a bug I should look at :)
i really like the powers of the new [osc*] objects for these kind of things.
here's an updated example, that properly generates numbers in to 0..1 range.
it has full 24bit of (pseudo) randomness.
gfmards IOhannes
On 02/06/16 08:09, IOhannes m zmölnig wrote:
On 05/31/2016 05:50 PM, IOhannes m zmoelnig wrote:
i really like the powers of the new [osc*] objects for these kind of things.
here's an updated example, that properly generates numbers in to 0..1 range.
it has full 24bit of (pseudo) randomness.
But the distribution is not uniform (lower third is twice as likely as the upper two thirds of the range). See attached for a test.
On 2016-06-02 09:25, Claude Heiland-Allen wrote:
On 02/06/16 08:09, IOhannes m zmölnig wrote:
On 05/31/2016 05:50 PM, IOhannes m zmoelnig wrote:
i really like the powers of the new [osc*] objects for these kind of things.
here's an updated example, that properly generates numbers in to 0..1 range.
it has full 24bit of (pseudo) randomness.
But the distribution is not uniform (lower third is twice as likely as the upper two thirds of the range). See attached for a test.
sigh indeed. it also misses a few values altogether.
so here's an update which i think has these issues fixed. at least your probability plot shows no anomalies, and it now uses all 23bit of the mantissa for randomness rather than just 20bit.
fgasdrm IOhannes
Your maximum [random] resolution is 2^24. You can send [1 (—[<< 24] to the right inlet of [random] and the right inlet of [/ ] and you'll have the max float resolution (assuming uniform distribution) between 0 and 1.
On Tue, May 31, 2016 at 10:44 AM, Raphaël Ilias phae.ilias@gmail.com wrote:
Hello list,
I want to do a simple task : pick a random float in a defined range (let's say between 0.0 and 1.0). I know there are this kind of objects in external libraries (something like [randomF] if remember), but since the collapse of Pd-Extended, I generally prefer to make vanilla abstractions.
The two solutions i foresee are :
solution #1 :
[random 1e+06] | [/ 1e+06]
but this way, it doesn't use the full floating-point resolution ?... and going over that range (like 1e_07) will result in errors (outputs 0) I guess because of floating-point complexity.
# solution #2 :
[noise~] | [snapshot~]
but this won't work if DSP/audio is turned off.
so I wondered if there are other vanilla and efficient solutions? ...or if I just have to get the external from deken... ? :)
thanks,
Raphaël
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
Ok thanks for pointing out the actual decimal precision limit, I get it, according to my understanding of 32-bit floats type.
I was also wondering why this kind of common function isn't implemented in vanilla, in the form of an objet, or even as standardized abstraction (like the list-abs ?) ? Because, it's like everyone has to :
(different names, in/outlets) and subject to errors in conception (like here, not using maximum range).
I know this might be a delicate debate, but I feel like this kind of function (like "floating-point random" but one could find other examples) could be provided as abstractions, since it's already useable but anyone who wants to learn can check the inner patch ?
Don't want to start a messy troll, but at least IMHO this feature really misses in vanilla,
++
Raphaël
2016-05-31 17:12 GMT+02:00 Matt Barber brbrofsvl@gmail.com:
Your maximum [random] resolution is 2^24. You can send [1 (—[<< 24] to the right inlet of [random] and the right inlet of [/ ] and you'll have the max float resolution (assuming uniform distribution) between 0 and 1.
On Tue, May 31, 2016 at 10:44 AM, Raphaël Ilias phae.ilias@gmail.com wrote:
Hello list,
I want to do a simple task : pick a random float in a defined range (let's say between 0.0 and 1.0). I know there are this kind of objects in external libraries (something like [randomF] if remember), but since the collapse of Pd-Extended, I generally prefer to make vanilla abstractions.
The two solutions i foresee are :
solution #1 :
[random 1e+06] | [/ 1e+06]
but this way, it doesn't use the full floating-point resolution ?... and going over that range (like 1e_07) will result in errors (outputs 0) I guess because of floating-point complexity.
# solution #2 :
[noise~] | [snapshot~]
but this won't work if DSP/audio is turned off.
so I wondered if there are other vanilla and efficient solutions? ...or if I just have to get the external from deken... ? :)
thanks,
Raphaël
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
Hi Raphaël,
Hello list,
I want to do a simple task : pick a random float in a defined range (let's say between 0.0 and 1.0). I know there are this kind of objects in external libraries (something like [randomF] if remember), but since the collapse of Pd-Extended, I generally prefer to make vanilla abstractions.
This is the best solution from educational point of view, and the most fun :-)
so I wondered if there are other vanilla and efficient solutions? ...or if I just have to get the external from deken... ? :)
The deken external library maxlib contains a collection of random number generators (see maxlib-help.pd for an overview). The usual range is 0-1, so you can multiply as you wish.
thanks,
Raphaël
Greetings & success,
Fred Jan
apparently no one knows as it is not documented, but [expr] has a range random function, so you can do something like.
[expr random(0, 1000)/1000.0)]
just bang it
cheers
2016-05-31 11:44 GMT-03:00 Raphaël Ilias phae.ilias@gmail.com:
Hello list,
I want to do a simple task : pick a random float in a defined range (let's say between 0.0 and 1.0). I know there are this kind of objects in external libraries (something like [randomF] if remember), but since the collapse of Pd-Extended, I generally prefer to make vanilla abstractions.
The two solutions i foresee are :
solution #1 :
[random 1e+06] | [/ 1e+06]
but this way, it doesn't use the full floating-point resolution ?... and going over that range (like 1e_07) will result in errors (outputs 0) I guess because of floating-point complexity.
# solution #2 :
[noise~] | [snapshot~]
but this won't work if DSP/audio is turned off.
so I wondered if there are other vanilla and efficient solutions? ...or if I just have to get the external from deken... ? :)
thanks,
Raphaël
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
On 06/01/2016 05:08 AM, Alexandre Torres Porres wrote:
apparently no one knows as it is not documented, but [expr] has a range random function, so you can do something like.
[expr random(0, 1000)/1000.0)]
hmm, how is this different from the following?
[random 1000] | [/ 1000]
more importantly, how does this use anything near the "full floating-point resolution" requested by the OP? (e.g. this random generator can never generate 0.1234)
dfsamra IOhannes
Hi,
On 31/05/2016 16:44, Raphaël Ilias wrote:
Hello list,
I want to do a simple task : pick a random float in a defined range (let's say between 0.0 and 1.0).
[...]
I generally prefer to make vanilla abstractions.
If you're after more random randomness you could search online for free random (or noise) sources, load them into an array, normalize 0.0 to 1.0 and read the array. Of course this may or may not fit your scenario depending on e.g. the rate at which you need to get a new random number etc.
Lorenzo.
Thanks everybody for your suggestions, I'll stay with the "full resolution" random 1<<24 since i only want uniform random, but i'll give a try to the mentionned externals.
all best,
Raphaël
2016-06-01 9:17 GMT+02:00 Lorenzo Sutton lorenzofsutton@gmail.com:
Hi,
On 31/05/2016 16:44, Raphaël Ilias wrote:
Hello list,
I want to do a simple task : pick a random float in a defined range (let's say between 0.0 and 1.0).
[...]
I generally prefer to make vanilla abstractions.
If you're after more random randomness you could search online for free random (or noise) sources, load them into an array, normalize 0.0 to 1.0 and read the array. Of course this may or may not fit your scenario depending on e.g. the rate at which you need to get a new random number etc.
Lorenzo.
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list