Hi List!
Can a random number form 0 to 100 be generated with the following requirements:
pd -noprefs -nogui givemerandom.pd
Thanks for looking into it
eni
On Wed, 2012-11-14 at 14:53 +0000, Enrique Erne wrote:
Hi List!
Can a random number form 0 to 100 be generated with the following requirements:
- No externals / Vanilla Pd only
- DSP must be off
- The patch is loaded with Pd through command line interface i.e.
pd -noprefs -nogui givemerandom.pd
- The output should not always be the same number
If you happen to start Pd always from bash / command-line, you do something like this:
pd -noprefs -nogui givemerandom.pd -send "seed $RANDOM"
and in your patch:
[r seed] | [seed $1( | [random]
However, I also would be interested in a solution that works without command-line arguments.
Roman
Hi,
You could use the [shell] object to run a little bash script that would ask the current time in milliseconds from your system, and send it as a seed to Pd using pdsend. This way you wouldn't need any extra command line arguments. I don't know whether this is worth the trouble, though.
Pierre.
2012/11/14 Roman Haefeli reduzent@gmail.com
On Wed, 2012-11-14 at 14:53 +0000, Enrique Erne wrote:
Hi List!
Can a random number form 0 to 100 be generated with the following
requirements:
- No externals / Vanilla Pd only
- DSP must be off
- The patch is loaded with Pd through command line interface i.e.
pd -noprefs -nogui givemerandom.pd
- The output should not always be the same number
If you happen to start Pd always from bash / command-line, you do something like this:
pd -noprefs -nogui givemerandom.pd -send "seed $RANDOM"
and in your patch:
[r seed] | [seed $1( | [random]
However, I also would be interested in a solution that works without command-line arguments.
Roman
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
On 14/11/12 15:53, Enrique Erne wrote:
Hi List!
Can a random number form 0 to 100 be generated with the following requirements:
- No externals / Vanilla Pd only
- DSP must be off
- The patch is loaded with Pd through command line interface i.e.
pd -noprefs -nogui givemerandom.pd
- The output should not always be the same number
Something like the attached should do it...
But as someone already pointed out is it really worth it? Why not just do something like (assuming you have BASH):
echo $[ $RANDOM % 100]
Lorenzo.
Hi Is the [time] object in pd-vanilla? If so you could use the milliseconds output as your seed... [loadbang] |[time] | (milliseconds) [random]
Date: Wed, 14 Nov 2012 14:53:44 +0000 From: enrique@netpd.org To: pd-list@iem.at Subject: [PD] Random number generation quest
Hi List!
Can a random number form 0 to 100 be generated with the following requirements:
- No externals / Vanilla Pd only
- DSP must be off
- The patch is loaded with Pd through command line interface i.e.
pd -noprefs -nogui givemerandom.pd
- The output should not always be the same number
Thanks for looking into it
eni
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Le 14/11/2012 18:30, Andrew Faraday a écrit :
Hi
Is the [time] object in pd-vanilla? If so you could use the milliseconds output as your seed...
[loadbang] | [time] | (milliseconds) [random]
Date: Wed, 14 Nov 2012 14:53:44 +0000 From: enrique@netpd.org To: pd-list@iem.at Subject: [PD] Random number generation quest
Hi List!
Can a random number form 0 to 100 be generated with the following
requirements:
- No externals / Vanilla Pd only
- DSP must be off
- The patch is loaded with Pd through command line interface i.e.
pd -noprefs -nogui givemerandom.pd
- The output should not always be the same number
Thanks for looking into it
eni
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management ->
http://lists.puredata.info/listinfo/pd-list
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Yep, but the first requirement for Enrique was :
So it doesn't work with zexy [time] (this not in Pd Vanilla ;). ++
Jack
On Wed, 14 Nov 2012 15:53:44 +0100, Enrique Erne enrique@netpd.org wrote:
Hi List!
Can a random number form 0 to 100 be generated with the following
requirements:
- No externals / Vanilla Pd only
- DSP must be off
- The patch is loaded with Pd through command line interface i.e.
pd -noprefs -nogui givemerandom.pd
- The output should not always be the same number
Thanks for looking into it
eni
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management ->
http://lists.puredata.info/listinfo/pd-list
Here's a solution using [realtime] and [del]
#N canvas 539 577 450 300 10; #X obj 184 51 loadbang; #X obj 184 125 realtime; #X obj 184 74 t b b; #X msg 211 195 seed $1; #X obj 184 96 del 5; #X obj 184 148 * 1000; #X obj 184 250 print; #X obj 184 171 t b f; #X obj 184 219 random 100; #X connect 0 0 2 0; #X connect 1 0 5 0; #X connect 2 0 4 0; #X connect 2 1 1 0; #X connect 3 0 8 0; #X connect 4 0 1 1; #X connect 5 0 7 0; #X connect 7 0 8 0; #X connect 7 1 3 0; #X connect 8 0 6 0;
Here's one that works in real time by building a subpatch with some objects, measuring that time, using that measurement to create and clear the subpatch anywhere from 0-9 more times, then multiplying the sum of all this time for the seed to [random]. Obviously if you create a complex object like [sigmund~] you'd get more variance but also a longer load time.
It looks to take less than a millisecond in the worst case for my version, but I don't know how random my randomness is.
Does someone have a tool to measure how random these approaches are?
-Jonathan
----- Original Message -----
From: Kaj Ailomaa zequence@mousike.me To: pd-list@iem.at Cc: Sent: Wednesday, November 14, 2012 3:24 PM Subject: Re: [PD] Random number generation quest
On Wed, 14 Nov 2012 15:53:44 +0100, Enrique Erne enrique@netpd.org wrote:
Hi List!
Can a random number form 0 to 100 be generated with the following
requirements:
- No externals / Vanilla Pd only - DSP must be off - The patch is loaded with Pd through command line interface i.e.
pd -noprefs -nogui givemerandom.pd
- The output should not always be the same numberThanks for looking into it
eni
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management ->
http://lists.puredata.info/listinfo/pd-list
Here's a solution using [realtime] and [del]
#N canvas 539 577 450 300 10; #X obj 184 51 loadbang; #X obj 184 125 realtime; #X obj 184 74 t b b; #X msg 211 195 seed $1; #X obj 184 96 del 5; #X obj 184 148 * 1000; #X obj 184 250 print; #X obj 184 171 t b f; #X obj 184 219 random 100; #X connect 0 0 2 0; #X connect 1 0 5 0; #X connect 2 0 4 0; #X connect 2 1 1 0; #X connect 3 0 8 0; #X connect 4 0 1 1; #X connect 5 0 7 0; #X connect 7 0 8 0; #X connect 7 1 3 0; #X connect 8 0 6 0;
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list