Random distribution with seed only outputting lists

I’m trying to update a variable by a random number, +0 if it fails first check, +1 or +2 if P = 1, and +1 if P doesn’t equal 1, but when I do, the variable turns into a list. I am pretty sure it’s because of the random numbers but I don’t know how to fix it.

https://www.desmos.com/calculator/sfc82d9pti

1 Like

The problem is that random(N) creates an array of N uniform random numbers,
so in your case you create an array with 1 element.

Here’s a possible solution:
https://www.desmos.com/calculator/xtlcwbhzki

1 Like

There is one case where it outputs a single value: random(List), or the dot notation List.random, which will output a single value from the list. As soon as you add arguments, or the form you noted, outputs are lists even if only a single element.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.