Login | Register 
Products Applications Downloads Features Wiki forum Store
 

random non-repeating

Still a little green? Ask your beginner's questions here

random non-repeating

Postby drxian » Mon Jun 11, 2012 9:30 pm

ok say i have a word list of 20 words. how can i read that from a file or from a list of text nodes
and select a series of say 6 random words sequentially without them repeating.
thanks!
drxian
 
Posts: 20
Joined: Thu Feb 26, 2009 12:29 pm

Re: random non-repeating

Postby selina » Sun Jun 17, 2012 1:51 pm

example attached. basically you do a bit of sorting.
Attachments
randomnonrepeating.tox
(774 Bytes) Downloaded 32 times
User avatar
selina
Staff
 
Posts: 368
Joined: Tue Nov 13, 2007 12:15 am

Re: random non-repeating

Postby drxian » Mon Jul 30, 2012 4:22 am

excellent thanks! yes i came to a similar solution myself. however i need to loop through the word list again and trigger a resort. when i do that though i get the nodes recooking every frame :( which i dont want... any suggestions?
drxian
 
Posts: 20
Joined: Thu Feb 26, 2009 12:29 pm

Re: random non-repeating

Postby drxian » Fri Aug 03, 2012 3:38 am

gettign there..

but trying to make the sorting re sort based on an incrementing chop value at a higher level in the project

$V $R rand($V+$R+'chop("$/project1/count_loop")')

but its not working :( the count_loop evals to 0 all the time?? as if it snow being evalued...
drxian
 
Posts: 20
Joined: Thu Feb 26, 2009 12:29 pm

Re: random non-repeating

Postby greg » Tue Aug 14, 2012 11:02 pm

Try this, the Count CHOP cooks every frame, but the script in chopexec1 only runs when the count changes (once every 2 seconds).

The script stuffs a different randomization expression in the table2 DAT, giving a different sort order every 2 seconds.

Scripts in DATs are useful for minimizing cooks in other operators because they can be set to execute only on other states changing.
Attachments
RandomNonRepeating.4.toe
(3.93 KiB) Downloaded 18 times
User avatar
greg
Staff
 
Posts: 291
Joined: Tue Nov 13, 2007 12:08 am


Return to Beginners

Who is online

Users browsing this forum: No registered users and 1 guest

cron