<div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Perhaps there is a use case for both functions?  One that generates a reproducible set of pseudo-random points, and one that generates a different set each time called.  </div><div><br></div><div>If so, it sounds like the "really random" function would have to be a separate VOLATILE declaration.</div><div><br></div><div>On a related note, generating random points using a simple random function produces quite "clumpy" point sets. There's lots of approaches to creating more evenly spaced quasi-random pointsets, such as Halton points [1] or using a distance tolerance [2].  It might be nice to provide one or more of these as functions as well.</div><div><br></div><div>[1] <a href="https://lin-ear-th-inking.blogspot.com/2012/09/halton-sequences-at-last.html">https://lin-ear-th-inking.blogspot.com/2012/09/halton-sequences-at-last.html</a></div><div>[2] <a href="https://lin-ear-th-inking.blogspot.com/2015/07/even-distribution-random-point-and.html">https://lin-ear-th-inking.blogspot.com/2015/07/even-distribution-random-point-and.html</a></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Jan 18, 2019 at 5:51 AM Darafei "Komяpa" Praliaskouski <<a href="mailto:me@komzpa.net">me@komzpa.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi Felix,<br><div><br></div><div>would you prefer the function to always return the same set of random points, or get the fact that it can return different set of points on invocations in different transactions documented?<br><br>I'm not sure treating it same as random() is a great idea, I use it more like "give me a point cloud that fills this polygon" converting it for usage in point-accepting functions, like calculating the median of the polygon. I'd prefer it cached like it is now for such cases. <br><br>What are you using your random geodata for? </div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Jan 16, 2019 at 1:11 AM Felix Kunde <<a href="mailto:felix-kunde@gmx.de" target="_blank">felix-kunde@gmx.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div style="font-family:Verdana;font-size:12px"><div>Hi list,</div>

<div> </div>

<div>I thought that this topic better belongs on this list.</div>

<div>I'm trying to create some random spatial data using the ST_GeneratePoints functions. I wanted to reuse it also for lines and polygons but stumbled over the issue that multiple calls of the function in one transaction produce the same result. I tested different query constructs - even looping over a PL/pgSQL function - but no luck. So whereas:</div>

<div> </div>

<div>SELECT</div>

<div>  random() AS random_a,</div>

<div>  random() AS random_b;</div>

<div> </div>

<div>creates different results, this:</div>

<div> </div>

<div>SELECT<br>
  ST_AsText(ST_GeneratePoints('POLYGON((0 0,1 0,1 1,0 1,0 0))'::geometry, 2)) AS random_a,<br>
  ST_AsText(ST_GeneratePoints('POLYGON((0 0,1 0,1 1,0 1,0 0))'::geometry, 2)) AS random_b;</div>

<div> </div>

<div>will produce the same. There are workaround to generate random geodata, of course.</div>

<div>Just wanted to point it out here and see, if you are aware of this. I couldn't found any ticket regarding this behaviour.</div>

<div> </div>

<div>Best, Felix</div></div></div><br></blockquote></div><br></blockquote></div></div></div></div>