On Tue, 8 Jul 2025 at 15:26, Aleksander Alekseev
wrote:
>
> The proposed function seems to do two things at a time - generating
> random values and transforming them into an array of desired
> dimensions. Generally we try to avoid such interfaces. Can you think
> of something like array_transform(
gt; we can easily use:
> SELECT array_random(1, 6, array[4,3, 2]);
>
> of course, we can use plpgsql to do it, but the c function would be
> more convenient.
> does this make sense?
The proposed function seems to do two things at a time - generating
random values and transforming them
On Sat, Jul 5, 2025 at 3:32 PM Vik Fearing wrote:
>
> On 30/06/2025 17:04, jian he wrote:
>
> reasons for adding array_random is:
> 1. This is better than array_fill. This can fill random and constant
> values (random, min and max the same).
> 2. Building a multi-dimensio
On Sat, 5 Jul 2025 at 08:32, Vik Fearing wrote:
>
> On 30/06/2025 17:04, jian he wrote:
>
> reasons for adding array_random is:
> 1. This is better than array_fill. This can fill random and constant
> values (random, min and max the same).
> 2. Building a multi-dimensio
On 30/06/2025 17:04, jian he wrote:
reasons for adding array_random is:
1. This is better than array_fill. This can fill random and constant
values (random, min and max the same).
2. Building a multi-dimensional PL/pgSQL function equivalent to
array_random is not efficient and is also not
On Mon, Jun 30, 2025 at 11:04 PM jian he wrote:
>
> demo:
> SELECT array_random(1, 6, array[2,5], array[2,4]);
> array_random
> --
> [2:3][4:8]={{6,2,2,5,4},{4,5,6,4,6}}
>
> reasons for adding array_random is:
> 1. Thi
hi.
context: [1].
the attached patch already posted in [1].
I don't want to hijack another thread. so I post it in a separate thread.
The attached patch introduces a new function: array_random.
array_random description:
Returns an array filled with random values in the range min <=