How do I create a list of randomly generated numbers?

I want to create a list of random numbers (as a die roller) and I can only seem to be able to make a list with the same randomly generated number repeated throughout. <insert that XKCD about 4 being a random number here:>

Hi @Sayantan_Chaudhuri

Does the below post give you the right direction

Random number/character generator

That is quite the formula, yes?

I did go over it before posting the thread, but given how specific that problem is I kind of hoped there would be a more general and simpler solution available than whatever it is doing. Needless to say, I have no idea how it works, and Coda itself throws some lengthy type errors when inspecting the formula which makes the process of deciphering it even scarier!

@Sayantan_Chaudhuri - Not easy to generate numbers on canvas - but here’s a way to generate it within table. you would need to use Button to generate the list

formula is:
ListCombine ( ModifyRows(thisRow, thisRow.[Random Numbers], ''), Sequence(1,thisRow.[How many random numbers],1).FormulaMap(RunActions(ModifyRows(thisRow, thisRow.[Random Numbers],ListCombine(thisRow.[Random Numbers], List(Random()))))) )

first part of the formula clears existing value and second part generates Random number and adds it to existing List for value in How many random numbers column. Each of this is basically creates an action (so effectively a list of actions) that is run when button is pressed.

2 Likes

I see. Actions are necessary to evaluate formulas on demand, and therefore generate independent random numbers. For my current use-case I can use a table just to store the list of numbers.

It also occurred to me that I can take a random number and “split it apart” to create several different random values as well! Is this what the formula in the ‘Random number/character generator’ thread doing?

2 Likes