Re: array_random

2025-07-11 Thread Dean Rasheed
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(

Re: array_random

2025-07-08 Thread Aleksander Alekseev
Hi, > it seems not trivial to wrap up all the generated random values into a > specific > multi-dimensional array (more than 2 dimensions). > for example, say we generated 24 random values and wanted to arrange them > into a > 3-dimensional array with shape [4, 3, 2]. > we can easily use: > SELE

Re: array_random

2025-07-08 Thread jian he
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-dimensional PL/pgSQL function equ

Re: array_random

2025-07-07 Thread Dean Rasheed
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-dimensional PL/pgSQL function equiv

Re: array_random

2025-07-05 Thread Vik Fearing
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 easie

Re: array_random

2025-07-04 Thread jian he
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. This is better than array_fill. T