Creating Lists of Random Things

Trying to create a list of random numbers.
Wanting to create it from an existing list of numbers.
So, want I want to acheive is:
number source_ids = (1,2,3,4,5,6,7,8,9,10)
number random_ids = ( 5,7,2,10,6) for example

I’ve set the above as state variables, then click a button, to invoke a workflow to:

set_state of random_ids = random_ids:plusitem source_ids:random_item

NOTE: I’ve omitted ‘this_button’s’ from above specification of state variables.

This works, so each time I press the button, random_ids shows another random number.
5
5,7
5,7,2

It stops working after 3 goes.
Also, the random numbers are not so random. They are the same everytime it runs.
It actually returns (4,8,12) each time.

I’ve tried the same formula (using :plusitem and :random_item) on state variables, fields (with type list of numbers) and new Things with fields of type number (and inserting multiple records). All result in the same behaviour.

Any thoughts appreciated.

This topic was automatically closed after 70 days. New replies are no longer allowed.