Log In  
Follow
djdiskmachine
[ :: Read More :: ]

I've made a couple of carts that I plan to use as a visual installation.
My setup is this:
One loader cart that selects a random number as index.
The loader cart uses the random number to index and load one of the visualiser carts.
When the visualiser cart has run for some time, it loads the loader cart again.
Repeat infinitely

The setup works pretty decent, but I have two issues:
Often the same visualiser cart gets selected several times in a row.
The random number generator tends to select some of the carts far more often than others.

My idea was to create an array that saves the indices in the loader cart. If the index is in the array, it should select a new number.
The issue is that the array in the loader cart doesn't seem to persist in between loads.
I tried passing the array to the visualiser cart but stat(6) doesn't seem to accept arrays.

Am I overcomplicating things and there's a simpler way to do it?

P#98164 2021-10-03 13:58

[ :: Read More :: ]

I'm trying to randomly select a value from an array.
I expected this to get me a random index in the array, but I'm getting the same every time.

 stmp={-130,50,500,1000,1500,2000,3000,3500}
 strt=rnd(#stmp)
 t=stmp[ceil(strt)]
 print(#stmp)
 print(strt)
 print(t)

Always prints:

8
0.5174 
-130
4.3404

I've used rnd() in other carts but I've never encountered this behavior before, please advice.

P#89940 2021-04-04 00:04 ( Edited 2021-04-04 00:04)

Follow Lexaloffle:          
Generated 2024-03-29 11:01:22 | 0.062s | Q:6