Hi,

I have a list of 200 tickets and every month I want 10 of these tickets to be cloned at random.

I was looking at https://community.atlassian.com/t5/Jira-Service-Management/Can-Jira-select-a-random-sample-of-issues-for-QA/qaq-p/1419911 but it’s not working on my side.

It only generates 120/125 random numbers when I need 200, right?

This is my automation:

https://community.atlassian.com/t5/image/serverpage/image-id/315245i63D0C2C8F5F6F96D/image-size/large?v=v2&px=999

Can you help us?

Thank you.

Hi @JooCunha,

What do you mean by this?

Do you mean that the smart value `{{#=}}CEILING(RANDOM()*200){{/}}`

can only

- Generate 125 unique values?, or
- Generate a value up to 125 at a maximum?

Cheers,

Ian

Hi @iragudo

Thanks for your quick reply.

Do you mean that the smart value `{{#=}}CEILING(RANDOM()*200){{/}}`

can only

Generate 125 unique values

Is it normal?

Hi @JooCunha,

I do not think that is normal. Based on the smart value math expression, it should generate integers from 1-200. In my understanding:

`RANDOM()`

will result in a value between 0 and 1. From my testing, the values I got look like `0.08560946671846403`

(when run with the math expression yields 18)
- Calling
`CEILING()`

rounds up the product of randomly generated value and 200, which in my current understanding *should* result in a value of 1-200 (i.e., 200 unique values)

Maybe I am missing something (or my math is wrong?), but how did you arrive at the conclusion that it only generates 125 unique values?

Also, upon checking your automation, in order to have a consistent result in your math expression, I’d recommend the use of variables (see image below). In your automation, the random number in the 2nd component has a big probability that it is different from the random number generated in the 3rd component (the *if condition* component).

Cheers,

Ian

2 Likes

Hi,

Thanks for your help! When using the variable it already gives me 200 random numbers.

Now I have another problem that sometimes the numbers repeat themselves, there is no solution for that, right?

Correct. It is a *random* number generator, not a *unique* number generator.

RANDOM() is giving a random decimal value between 0 and 1, then you are repeating that 200 times. When you then apply CEILING(), you are then trimming out a degree of the ‘uniqueness’ of those numbers.

You have created the equivalent of a roulette wheel with 200 possible numbers, but that doesn’t mean the ball can’t fall on the same number more than once.

2 Likes