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 <[email protected]> > To: [email protected] > 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 <[email protected]> > 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 >> >> _______________________________________________ >> [email protected] 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; > > _______________________________________________ > [email protected] mailing list > UNSUBSCRIBE and account-management -> > http://lists.puredata.info/listinfo/pd-list >
time-waster.pd
Description: Binary data
_______________________________________________ [email protected] mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
