Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"Show business is just like high school, except you get paid." -- Martin Mull


devel / comp.lang.c / random points near central point

SubjectAuthor
* random points near central pointfir
+* Re: random points near central pointMalcolm McLean
|`- Re: random points near central pointfir
+- Re: random points near central pointMalcolm McLean
+- Re: random points near central pointKaz Kylheku
+* Re: random points near central pointBen Bacarisse
|`* Re: random points near central pointfir
| +* Re: random points near central pointBen Bacarisse
| |+* Re: random points near central pointfir
| ||+- Re: random points near central pointBen Bacarisse
| ||`* Re: random points near central pointDavid Brown
| || `* Re: random points near central pointfir
| ||  `* Re: random points near central pointEd Prochak
| ||   `* Re: random points near central pointfir
| ||    +* Re: random points near central pointBen Bacarisse
| ||    |`* Re: random points near central pointfir
| ||    | `- Re: random points near central pointChris M. Thomasson
| ||    `* Re: random points near central pointEd Prochak
| ||     `- Re: random points near central pointfir
| |`- Re: random points near central pointfir
| `* Re: random points near central pointChris M. Thomasson
|  `* Re: random points near central pointfir
|   `- Re: random points near central pointChris M. Thomasson
+- Re: random points near central pointChris M. Thomasson
+* Re: random points near central pointBonita Montero
|`* Re: random points near central pointfir
| +- Re: random points near central pointfir
| `* Re: random points near central pointBonita Montero
|  `- Re: random points near central pointfir
+* Re: random points near central pointJohn Forkosh
|`* Re: random points near central pointfir
| `* Re: random points near central pointJohn Forkosh
|  `* Re: random points near central pointfir
|   `- Re: random points near central pointfir
`- Re: random points near central pointChris M. Thomasson

Pages:12
random points near central point

<eb9e82fb-265b-42a7-a245-1943e5b3b5aan@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=26292&group=comp.lang.c#26292

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:622a:15c3:b0:3f1:fc85:9d74 with SMTP id d3-20020a05622a15c300b003f1fc859d74mr19078qty.6.1689748681156;
Tue, 18 Jul 2023 23:38:01 -0700 (PDT)
X-Received: by 2002:a05:6870:5b14:b0:1ba:7bf5:67a4 with SMTP id
ds20-20020a0568705b1400b001ba7bf567a4mr9123591oab.11.1689748680937; Tue, 18
Jul 2023 23:38:00 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border-2.nntp.ord.giganews.com!border-1.nntp.ord.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Tue, 18 Jul 2023 23:38:00 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=5.172.255.87; posting-account=Sb6m8goAAABbWsBL7gouk3bfLsuxwMgN
NNTP-Posting-Host: 5.172.255.87
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <eb9e82fb-265b-42a7-a245-1943e5b3b5aan@googlegroups.com>
Subject: random points near central point
From: profesor...@gmail.com (fir)
Injection-Date: Wed, 19 Jul 2023 06:38:01 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 13
 by: fir - Wed, 19 Jul 2023 06:38 UTC

i need tos et asteroids in game (about 100 or 200) but not in square
area with two rands one for x and second for y but need it to
be sphericel symetric around central point and in more densitu near it and less desity with bigger radius until some radius when it is zero

something like

SetRandomPointSphericalSymetricAndFadingWithDistance(
float x, float y, float r1, float r2);

this r1 is radius of circle below which density is max and r2 is radius
where above density is zero - in beetweem r1 and r2 density should
be from max (at r1) to zero at r2

how to do that?

Re: random points near central point

<c3dced30-da13-423d-8f54-314b8aacecd3n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=26296&group=comp.lang.c#26296

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:622a:1992:b0:403:ab15:17a0 with SMTP id u18-20020a05622a199200b00403ab1517a0mr10826qtc.12.1689756540756;
Wed, 19 Jul 2023 01:49:00 -0700 (PDT)
X-Received: by 2002:a05:6830:1359:b0:6b9:91bb:e49e with SMTP id
r25-20020a056830135900b006b991bbe49emr16309353otq.7.1689756540581; Wed, 19
Jul 2023 01:49:00 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Wed, 19 Jul 2023 01:49:00 -0700 (PDT)
In-Reply-To: <eb9e82fb-265b-42a7-a245-1943e5b3b5aan@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2a00:23a8:400a:5601:a5fc:a56:9708:79c3;
posting-account=Dz2zqgkAAADlK5MFu78bw3ab-BRFV4Qn
NNTP-Posting-Host: 2a00:23a8:400a:5601:a5fc:a56:9708:79c3
References: <eb9e82fb-265b-42a7-a245-1943e5b3b5aan@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <c3dced30-da13-423d-8f54-314b8aacecd3n@googlegroups.com>
Subject: Re: random points near central point
From: malcolm....@gmail.com (Malcolm McLean)
Injection-Date: Wed, 19 Jul 2023 08:49:00 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2300
 by: Malcolm McLean - Wed, 19 Jul 2023 08:49 UTC

On Wednesday, 19 July 2023 at 07:38:10 UTC+1, fir wrote:
> i need tos et asteroids in game (about 100 or 200) but not in square
> area with two rands one for x and second for y but need it to
> be sphericel symetric around central point and in more densitu near it and less desity with bigger radius until some radius when it is zero
>
> something like
>
> SetRandomPointSphericalSymetricAndFadingWithDistance(
> float x, float y, float r1, float r2);
>
> this r1 is radius of circle below which density is max and r2 is radius
> where above density is zero - in beetweem r1 and r2 density should
> be from max (at r1) to zero at r2
>
> how to do that?
>
Th easy way to do it is to create three random values on -radius to radius, then calculate
the length with sqrt(x*x + y*y +z*z). If the length is greater thanthe radius, reject and
try again.
Matematicians don't like this because as you scale up to higher dimensions it becomes
less and less efficient.

If yiu want to solve the problem generally, try this link.
https://deepblue.lib.umich.edu/handle/2027.42/35534

Re: random points near central point

<76456298-7ba4-4dcd-887a-d26c492c7b99n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=26297&group=comp.lang.c#26297

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:622a:15c4:b0:403:acaa:abe0 with SMTP id d4-20020a05622a15c400b00403acaaabe0mr11020qty.8.1689757160928;
Wed, 19 Jul 2023 01:59:20 -0700 (PDT)
X-Received: by 2002:a05:6870:a881:b0:1b3:99b4:3e46 with SMTP id
eb1-20020a056870a88100b001b399b43e46mr17495069oab.8.1689757160618; Wed, 19
Jul 2023 01:59:20 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Wed, 19 Jul 2023 01:59:20 -0700 (PDT)
In-Reply-To: <eb9e82fb-265b-42a7-a245-1943e5b3b5aan@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2a00:23a8:400a:5601:a5fc:a56:9708:79c3;
posting-account=Dz2zqgkAAADlK5MFu78bw3ab-BRFV4Qn
NNTP-Posting-Host: 2a00:23a8:400a:5601:a5fc:a56:9708:79c3
References: <eb9e82fb-265b-42a7-a245-1943e5b3b5aan@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <76456298-7ba4-4dcd-887a-d26c492c7b99n@googlegroups.com>
Subject: Re: random points near central point
From: malcolm....@gmail.com (Malcolm McLean)
Injection-Date: Wed, 19 Jul 2023 08:59:20 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Malcolm McLean - Wed, 19 Jul 2023 08:59 UTC

On Wednesday, 19 July 2023 at 07:38:10 UTC+1, fir wrote:
> i need tos et asteroids in game (about 100 or 200) but not in square
> area with two rands one for x and second for y but need it to
> be sphericel symetric around central point and in more densitu near it and less desity with bigger radius until some radius when it is zero
>
> something like
>
> SetRandomPointSphericalSymetricAndFadingWithDistance(
> float x, float y, float r1, float r2);
>
> this r1 is radius of circle below which density is max and r2 is radius
> where above density is zero - in beetweem r1 and r2 density should
> be from max (at r1) to zero at r2
>
> how to do that?
>
Sorry, I misread your post.

You can probaly get away with caluclating the angle using a uniform random number,
and devising some non-uniform random number for the distance. A curve with a box
out to r1 and a triangle out to r2 wil probably suffice.
You need to integrate the curve, which sounds scary, but all it means is that you need
the area of the box (width time height) and the are of the triangle (hlaf width times
height). That tells you if the unform random number is inthe box or the triangle. If
it's inthe box, it;s a simple division to get how far along the box it is on the x co-ordinate.
If it's in the triangle, it's a bit more involved. You need solve the equation 0.5( 1-x)^2 = p,
where p is your uniform random number, rescaled to lop off the proportion of the box.

Re: random points near central point

<9fc883b7-9b58-4a84-a0b5-97248536a5dcn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=26300&group=comp.lang.c#26300

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:ac8:590c:0:b0:403:cecf:8c12 with SMTP id 12-20020ac8590c000000b00403cecf8c12mr96208qty.5.1689765604754;
Wed, 19 Jul 2023 04:20:04 -0700 (PDT)
X-Received: by 2002:a05:6870:a892:b0:1b0:21ca:3aff with SMTP id
eb18-20020a056870a89200b001b021ca3affmr2213357oab.5.1689765604525; Wed, 19
Jul 2023 04:20:04 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!newsfeed.hasname.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Wed, 19 Jul 2023 04:20:04 -0700 (PDT)
In-Reply-To: <c3dced30-da13-423d-8f54-314b8aacecd3n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=5.172.255.65; posting-account=Sb6m8goAAABbWsBL7gouk3bfLsuxwMgN
NNTP-Posting-Host: 5.172.255.65
References: <eb9e82fb-265b-42a7-a245-1943e5b3b5aan@googlegroups.com> <c3dced30-da13-423d-8f54-314b8aacecd3n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <9fc883b7-9b58-4a84-a0b5-97248536a5dcn@googlegroups.com>
Subject: Re: random points near central point
From: profesor...@gmail.com (fir)
Injection-Date: Wed, 19 Jul 2023 11:20:04 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3017
 by: fir - Wed, 19 Jul 2023 11:20 UTC

środa, 19 lipca 2023 o 10:49:09 UTC+2 Malcolm McLean napisał(a):
> On Wednesday, 19 July 2023 at 07:38:10 UTC+1, fir wrote:
> > i need tos et asteroids in game (about 100 or 200) but not in square
> > area with two rands one for x and second for y but need it to
> > be sphericel symetric around central point and in more densitu near it and less desity with bigger radius until some radius when it is zero
> >
> > something like
> >
> > SetRandomPointSphericalSymetricAndFadingWithDistance(
> > float x, float y, float r1, float r2);
> >
> > this r1 is radius of circle below which density is max and r2 is radius
> > where above density is zero - in beetweem r1 and r2 density should
> > be from max (at r1) to zero at r2
> >
> > how to do that?
> >
> Th easy way to do it is to create three random values on -radius to radius, then calculate
> the length with sqrt(x*x + y*y +z*z). If the length is greater thanthe radius, reject and
> try again.
> Matematicians don't like this because as you scale up to higher dimensions it becomes
> less and less efficient.
>

its okay though as i said i sont need only to have random in circle but gave linearrly more near centre and linearly less far from centre until some radius when i have none

but possibly i can made it with a percent of rejection... i mean count percent of rejection

float percent_of_rejection = (r-r1)(r2-r1); then use it to reject

int do_reject = rand2(0,100)<percent_of_rejection *100;

if(!do_reject)
{ //add
}

something like taht probably its ok, i dont need top efficiency or acurracy its for initialisation of goroups of asteroid or other things like that in 2d space

Re: random points near central point

<20230719001508.499@kylheku.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=26321&group=comp.lang.c#26321

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 864-117-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.c
Subject: Re: random points near central point
Date: Wed, 19 Jul 2023 16:50:54 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 5
Message-ID: <20230719001508.499@kylheku.com>
References: <eb9e82fb-265b-42a7-a245-1943e5b3b5aan@googlegroups.com>
Injection-Date: Wed, 19 Jul 2023 16:50:54 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="166ade1046392af984099983cd900df5";
logging-data="2358201"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18qnKVGVAV3MtxzrqDgdguI6SDHQXljMYs="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:PIjwb3qo9zfsPnurkg1hV/+6IF4=
 by: Kaz Kylheku - Wed, 19 Jul 2023 16:50 UTC

On 2023-07-19, fir <profesor.fir@gmail.com> wrote:
> where above density is zero - in beetweem r1 and r2 density should
> be from max (at r1) to zero at r2

Kinda like your hydrocephalic melon?

Re: random points near central point

<87tttzr9h0.fsf@bsb.me.uk>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=26329&group=comp.lang.c#26329

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ben.use...@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.lang.c
Subject: Re: random points near central point
Date: Wed, 19 Jul 2023 20:23:55 +0100
Organization: A noiseless patient Spider
Lines: 27
Message-ID: <87tttzr9h0.fsf@bsb.me.uk>
References: <eb9e82fb-265b-42a7-a245-1943e5b3b5aan@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="728d517973707f8d78d2018e7dcfa5fb";
logging-data="2409509"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18qrM3FAMzjY1rXio+0rlvDDizA7Q78EvU="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:6EIsn7w0fOOKomsD0ZB1YrM6MDw=
sha1:eavWDJNS4Kyxte4AJY2zsbUGZH8=
X-BSB-Auth: 1.4095e840fbcbcedb30bc.20230719202355BST.87tttzr9h0.fsf@bsb.me.uk
 by: Ben Bacarisse - Wed, 19 Jul 2023 19:23 UTC

fir <profesor.fir@gmail.com> writes:

> i need tos et asteroids in game (about 100 or 200) but not in square
> area with two rands one for x and second for y but need it to
> be sphericel symetric around central point and in more densitu near it
> and less desity with bigger radius until some radius when it is zero

If you just pick a uniform angle and a uniform radius and plot those
points, the density of points near the origin will be higher. This is a
very simple method and might be suitable for a game.

> something like
>
> SetRandomPointSphericalSymetricAndFadingWithDistance(
> float x, float y, float r1, float r2);

This suggests that I've not understood your opening paragraph, but I
offer the solution in case someone else might be interested.

> this r1 is radius of circle below which density is max and r2 is radius
> where above density is zero - in beetweem r1 and r2 density should
> be from max (at r1) to zero at r2
>
> how to do that?

--
Ben.

Re: random points near central point

<a0756188-052d-406b-8fe8-7c6a071be044n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=26373&group=comp.lang.c#26373

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:620a:f06:b0:762:3d49:c90e with SMTP id v6-20020a05620a0f0600b007623d49c90emr102822qkl.6.1689870684008;
Thu, 20 Jul 2023 09:31:24 -0700 (PDT)
X-Received: by 2002:a05:6870:f80a:b0:1ba:82c3:a56d with SMTP id
fr10-20020a056870f80a00b001ba82c3a56dmr74000oab.1.1689870683486; Thu, 20 Jul
2023 09:31:23 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Thu, 20 Jul 2023 09:31:23 -0700 (PDT)
In-Reply-To: <87tttzr9h0.fsf@bsb.me.uk>
Injection-Info: google-groups.googlegroups.com; posting-host=5.172.255.4; posting-account=Sb6m8goAAABbWsBL7gouk3bfLsuxwMgN
NNTP-Posting-Host: 5.172.255.4
References: <eb9e82fb-265b-42a7-a245-1943e5b3b5aan@googlegroups.com> <87tttzr9h0.fsf@bsb.me.uk>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <a0756188-052d-406b-8fe8-7c6a071be044n@googlegroups.com>
Subject: Re: random points near central point
From: profesor...@gmail.com (fir)
Injection-Date: Thu, 20 Jul 2023 16:31:24 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2581
 by: fir - Thu, 20 Jul 2023 16:31 UTC

środa, 19 lipca 2023 o 21:24:09 UTC+2 Ben Bacarisse napisał(a):
> fir <profes...@gmail.com> writes:
>
> > i need tos et asteroids in game (about 100 or 200) but not in square
> > area with two rands one for x and second for y but need it to
> > be sphericel symetric around central point and in more densitu near it
> > and less desity with bigger radius until some radius when it is zero
> If you just pick a uniform angle and a uniform radius and plot those
> points, the density of points near the origin will be higher. This is a
> very simple method and might be suitable for a game.

uniform radius? dont know what is that

generally i need whole pack of functions to set things arndomly but not just in rectangle whuich
will be given by applaying rand to x and y
this spherical group with decaying density with radius is one of that

> > something like
> >
> > SetRandomPointSphericalSymetricAndFadingWithDistance(
> > float x, float y, float r1, float r2);
> This suggests that I've not understood your opening paragraph, but I
> offer the solution in case someone else might be interested.
> > this r1 is radius of circle below which density is max and r2 is radius
> > where above density is zero - in beetweem r1 and r2 density should
> > be from max (at r1) to zero at r2
> >
> > how to do that?
> --
> Ben.

Re: random points near central point

<874jlyqsi1.fsf@bsb.me.uk>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=26379&group=comp.lang.c#26379

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ben.use...@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.lang.c
Subject: Re: random points near central point
Date: Thu, 20 Jul 2023 20:42:46 +0100
Organization: A noiseless patient Spider
Lines: 39
Message-ID: <874jlyqsi1.fsf@bsb.me.uk>
References: <eb9e82fb-265b-42a7-a245-1943e5b3b5aan@googlegroups.com>
<87tttzr9h0.fsf@bsb.me.uk>
<a0756188-052d-406b-8fe8-7c6a071be044n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: dont-email.me; posting-host="718a5a877a69dbd1318115baaef9d27f";
logging-data="3004857"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18CTB/lMRhwpvnr+41XX74/FwVV8AUksTI="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:+CCfQ4oFoWN7rHZf3AnE3dsNvZo=
sha1:PUTEVcp2oouaorSfID0jxkwJnZE=
X-BSB-Auth: 1.c8881667872ca1df0149.20230720204246BST.874jlyqsi1.fsf@bsb.me.uk
 by: Ben Bacarisse - Thu, 20 Jul 2023 19:42 UTC

fir <profesor.fir@gmail.com> writes:

> środa, 19 lipca 2023 o 21:24:09 UTC+2 Ben Bacarisse napisał(a):
>> fir <profes...@gmail.com> writes:
>>
>> > i need tos et asteroids in game (about 100 or 200) but not in square
>> > area with two rands one for x and second for y but need it to
>> > be sphericel symetric around central point and in more densitu near it
>> > and less desity with bigger radius until some radius when it is zero
>> If you just pick a uniform angle and a uniform radius and plot those
>> points, the density of points near the origin will be higher. This is a
>> very simple method and might be suitable for a game.
>
> uniform radius? dont know what is that

Uniform refers to a statistical distribution with uniform density --
every result in some range is equally likely. Your random number
generator will have a function to give you a number uniformly
distributed in some range (often >= 0.0 to < 1.0). I'll use drand48()
as an example.

double pi = 4 * atan(1);
double r = drand48();
double a = 2 * pi * drand48();

Now if you plot the point at angle a and distance r from (0,0) you will
see that they all lie in the unit circle but they cluster round the
origin.

Obviously you can convert polar coordinates r and a to Cartesian x and y
with

double x = r * cos(a), y = r * sin(a);

I'm not sure if this is what you want, but it sounds like it from some
of the words you used.

--
Ben.

Re: random points near central point

<2c181aeb-49e4-45b8-8be1-fc1189878e3en@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=26381&group=comp.lang.c#26381

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:620a:4093:b0:767:55c4:572b with SMTP id f19-20020a05620a409300b0076755c4572bmr104740qko.3.1689882964586;
Thu, 20 Jul 2023 12:56:04 -0700 (PDT)
X-Received: by 2002:a05:6808:2018:b0:3a3:644a:b55 with SMTP id
q24-20020a056808201800b003a3644a0b55mr1207069oiw.4.1689882964348; Thu, 20 Jul
2023 12:56:04 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border-2.nntp.ord.giganews.com!border-1.nntp.ord.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Thu, 20 Jul 2023 12:56:03 -0700 (PDT)
In-Reply-To: <874jlyqsi1.fsf@bsb.me.uk>
Injection-Info: google-groups.googlegroups.com; posting-host=5.172.255.155; posting-account=Sb6m8goAAABbWsBL7gouk3bfLsuxwMgN
NNTP-Posting-Host: 5.172.255.155
References: <eb9e82fb-265b-42a7-a245-1943e5b3b5aan@googlegroups.com>
<87tttzr9h0.fsf@bsb.me.uk> <a0756188-052d-406b-8fe8-7c6a071be044n@googlegroups.com>
<874jlyqsi1.fsf@bsb.me.uk>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <2c181aeb-49e4-45b8-8be1-fc1189878e3en@googlegroups.com>
Subject: Re: random points near central point
From: profesor...@gmail.com (fir)
Injection-Date: Thu, 20 Jul 2023 19:56:04 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 55
 by: fir - Thu, 20 Jul 2023 19:56 UTC

czwartek, 20 lipca 2023 o 21:43:02 UTC+2 Ben Bacarisse napisał(a):
> fir <profes...@gmail.com> writes:
>
> > środa, 19 lipca 2023 o 21:24:09 UTC+2 Ben Bacarisse napisał(a):
> >> fir <profes...@gmail.com> writes:
> >>
> >> > i need tos et asteroids in game (about 100 or 200) but not in square
> >> > area with two rands one for x and second for y but need it to
> >> > be sphericel symetric around central point and in more densitu near it
> >> > and less desity with bigger radius until some radius when it is zero
> >> If you just pick a uniform angle and a uniform radius and plot those
> >> points, the density of points near the origin will be higher. This is a
> >> very simple method and might be suitable for a game.
> >
> > uniform radius? dont know what is that
> Uniform refers to a statistical distribution with uniform density --
> every result in some range is equally likely. Your random number
> generator will have a function to give you a number uniformly
> distributed in some range (often >= 0.0 to < 1.0). I'll use drand48()
> as an example.
>
> double pi = 4 * atan(1);
> double r = drand48();
> double a = 2 * pi * drand48();
>
> Now if you plot the point at angle a and distance r from (0,0) you will
> see that they all lie in the unit circle but they cluster round the
> origin.
>
> Obviously you can convert polar coordinates r and a to Cartesian x and y
> with
>
> double x = r * cos(a), y = r * sin(a);
>
> I'm not sure if this is what you want, but it sounds like it from some
> of the words you used.
>

no i just need to add rangom grou[p which is randomly spgerical amd has more density near centre and which get downs to zero at some radius R2
the centre of it (with some radius R) should have some flat density ...iys not just much important what but flad

say i need to put 200 asteroids around some point - in rhe radius say 500 meters they should have 100% density between radius 500 to 1000 metars the density should drop to 0%

Re: random points near central point

<u9c3h4$2rpbs$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=26382&group=comp.lang.c#26382

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c
Subject: Re: random points near central point
Date: Thu, 20 Jul 2023 12:56:19 -0700
Organization: A noiseless patient Spider
Lines: 22
Message-ID: <u9c3h4$2rpbs$1@dont-email.me>
References: <eb9e82fb-265b-42a7-a245-1943e5b3b5aan@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 20 Jul 2023 19:56:20 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="548cb02f8621473374aa0fef010fdab5";
logging-data="3007868"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/pLfvBTneDZZduOvDbkUCNZekzi9xQa9w="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Cancel-Lock: sha1:sQYFUTpU9QqW2ZY+WMBrUTahowQ=
In-Reply-To: <eb9e82fb-265b-42a7-a245-1943e5b3b5aan@googlegroups.com>
Content-Language: en-US
 by: Chris M. Thomasson - Thu, 20 Jul 2023 19:56 UTC

On 7/18/2023 11:38 PM, fir wrote:
> i need tos et asteroids in game (about 100 or 200) but not in square
> area with two rands one for x and second for y but need it to
> be sphericel symetric around central point and in more densitu near it and less desity with bigger radius until some radius when it is zero
>
> something like
>
> SetRandomPointSphericalSymetricAndFadingWithDistance(
> float x, float y, float r1, float r2);
>
> this r1 is radius of circle below which density is max and r2 is radius
> where above density is zero - in beetweem r1 and r2 density should
> be from max (at r1) to zero at r2
>
> how to do that?

Diffuse the points around the central point. This is an example however
it has a bias in the corners of the rotated unit square:

http://fractallife247.com/fdla/

Click around.

Re: random points near central point

<u9c3iv$2rpbs$2@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=26383&group=comp.lang.c#26383

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c
Subject: Re: random points near central point
Date: Thu, 20 Jul 2023 12:57:18 -0700
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <u9c3iv$2rpbs$2@dont-email.me>
References: <eb9e82fb-265b-42a7-a245-1943e5b3b5aan@googlegroups.com>
<87tttzr9h0.fsf@bsb.me.uk>
<a0756188-052d-406b-8fe8-7c6a071be044n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 20 Jul 2023 19:57:19 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="548cb02f8621473374aa0fef010fdab5";
logging-data="3007868"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19T201sFUzCkbu/iYJWkSIoR9hYdw/vDHA="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Cancel-Lock: sha1:K1wBgnrwRrXZ7GTxAsHdjhQdFfo=
Content-Language: en-US
In-Reply-To: <a0756188-052d-406b-8fe8-7c6a071be044n@googlegroups.com>
 by: Chris M. Thomasson - Thu, 20 Jul 2023 19:57 UTC

On 7/20/2023 9:31 AM, fir wrote:
> środa, 19 lipca 2023 o 21:24:09 UTC+2 Ben Bacarisse napisał(a):
>> fir <profes...@gmail.com> writes:
>>
>>> i need tos et asteroids in game (about 100 or 200) but not in square
>>> area with two rands one for x and second for y but need it to
>>> be sphericel symetric around central point and in more densitu near it
>>> and less desity with bigger radius until some radius when it is zero
>> If you just pick a uniform angle and a uniform radius and plot those
>> points, the density of points near the origin will be higher. This is a
>> very simple method and might be suitable for a game.
>
> uniform radius? dont know what is that
>
> generally i need whole pack of functions to set things arndomly but not just in rectangle whuich
> will be given by applaying rand to x and y
> this spherical group with decaying density with radius is one of that
>
>>> something like
>>>
>>> SetRandomPointSphericalSymetricAndFadingWithDistance(
>>> float x, float y, float r1, float r2);
>> This suggests that I've not understood your opening paragraph, but I
>> offer the solution in case someone else might be interested.
>>> this r1 is radius of circle below which density is max and r2 is radius
>>> where above density is zero - in beetweem r1 and r2 density should
>>> be from max (at r1) to zero at r2
>>>
>>> how to do that?

Random angles and random radii that are locked in the unit circle?
Should be good enough?

Re: random points near central point

<87sf9ipd5e.fsf@bsb.me.uk>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=26384&group=comp.lang.c#26384

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ben.use...@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.lang.c
Subject: Re: random points near central point
Date: Thu, 20 Jul 2023 20:59:41 +0100
Organization: A noiseless patient Spider
Lines: 51
Message-ID: <87sf9ipd5e.fsf@bsb.me.uk>
References: <eb9e82fb-265b-42a7-a245-1943e5b3b5aan@googlegroups.com>
<87tttzr9h0.fsf@bsb.me.uk>
<a0756188-052d-406b-8fe8-7c6a071be044n@googlegroups.com>
<874jlyqsi1.fsf@bsb.me.uk>
<2c181aeb-49e4-45b8-8be1-fc1189878e3en@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: dont-email.me; posting-host="718a5a877a69dbd1318115baaef9d27f";
logging-data="3004857"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18J+Iib3CRWnK+Q4YLx5UW7PTEpMMFSutM="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:1L/YCDD32RiLd7FAcv4Rh9BgUuA=
sha1:hCSBZZn6zuuyPUmkat+X2RNv7HI=
X-BSB-Auth: 1.a26bf535bf190175e4fd.20230720205941BST.87sf9ipd5e.fsf@bsb.me.uk
 by: Ben Bacarisse - Thu, 20 Jul 2023 19:59 UTC

fir <profesor.fir@gmail.com> writes:

> czwartek, 20 lipca 2023 o 21:43:02 UTC+2 Ben Bacarisse napisał(a):
>> fir <profes...@gmail.com> writes:
>>
>> > środa, 19 lipca 2023 o 21:24:09 UTC+2 Ben Bacarisse napisał(a):
>> >> fir <profes...@gmail.com> writes:
>> >>
>> >> > i need tos et asteroids in game (about 100 or 200) but not in square
>> >> > area with two rands one for x and second for y but need it to
>> >> > be sphericel symetric around central point and in more densitu near it
>> >> > and less desity with bigger radius until some radius when it is zero
>> >> If you just pick a uniform angle and a uniform radius and plot those
>> >> points, the density of points near the origin will be higher. This is a
>> >> very simple method and might be suitable for a game.
>> >
>> > uniform radius? dont know what is that
>> Uniform refers to a statistical distribution with uniform density --
>> every result in some range is equally likely. Your random number
>> generator will have a function to give you a number uniformly
>> distributed in some range (often >= 0.0 to < 1.0). I'll use drand48()
>> as an example.
>>
>> double pi = 4 * atan(1);
>> double r = drand48();
>> double a = 2 * pi * drand48();
>>
>> Now if you plot the point at angle a and distance r from (0,0) you will
>> see that they all lie in the unit circle but they cluster round the
>> origin.
>>
>> Obviously you can convert polar coordinates r and a to Cartesian x and y
>> with
>>
>> double x = r * cos(a), y = r * sin(a);
>>
>> I'm not sure if this is what you want, but it sounds like it from some
>> of the words you used.
>
> no i just need to add rangom grou[p which is randomly spgerical amd
> has more density near centre and which get downs to zero at some
> radius R2 the centre of it (with some radius R) should have some flat
> density ...iys not just much important what but flad

I wish you well. If you want to ask in a group where English is widely
used, can you find someone to review your posts? I have no idea what
you are asking, but please don't spend any time explaining it -- I don't
need to know.

--
Ben.

Re: random points near central point

<64228552-63a4-45b2-b332-b29d05967707n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=26389&group=comp.lang.c#26389

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:620a:4613:b0:767:2c6f:dc49 with SMTP id br19-20020a05620a461300b007672c6fdc49mr9962qkb.6.1689884284057;
Thu, 20 Jul 2023 13:18:04 -0700 (PDT)
X-Received: by 2002:a05:6870:5a82:b0:1b0:5c0a:c047 with SMTP id
dt2-20020a0568705a8200b001b05c0ac047mr909412oab.2.1689884283833; Thu, 20 Jul
2023 13:18:03 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Thu, 20 Jul 2023 13:18:03 -0700 (PDT)
In-Reply-To: <u9c3iv$2rpbs$2@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=5.172.255.155; posting-account=Sb6m8goAAABbWsBL7gouk3bfLsuxwMgN
NNTP-Posting-Host: 5.172.255.155
References: <eb9e82fb-265b-42a7-a245-1943e5b3b5aan@googlegroups.com>
<87tttzr9h0.fsf@bsb.me.uk> <a0756188-052d-406b-8fe8-7c6a071be044n@googlegroups.com>
<u9c3iv$2rpbs$2@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <64228552-63a4-45b2-b332-b29d05967707n@googlegroups.com>
Subject: Re: random points near central point
From: profesor...@gmail.com (fir)
Injection-Date: Thu, 20 Jul 2023 20:18:04 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 1811
 by: fir - Thu, 20 Jul 2023 20:18 UTC

czwartek, 20 lipca 2023 o 21:57:33 UTC+2 Chris M. Thomasson napisał(a):
> On 7/20/2023 9:31 AM, fir wrote:
> >>> how to do that?
> Random angles and random radii that are locked in the unit circle?
> Should be good enough?

i dont know maybe randomize in circle of R2 then in some steps randomize in smaller circle until i reach R1 ?

there should be some easy methods i guess..hovevver im not sur if geting random in polar coordinates gives really random in 2d space...maybe its natorally more density near centre then?

Re: random points near central point

<60c604ee-8eb2-4748-abba-080c8a7e2faan@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=26390&group=comp.lang.c#26390

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:620a:4691:b0:767:f368:7b1d with SMTP id bq17-20020a05620a469100b00767f3687b1dmr9664qkb.9.1689884428186;
Thu, 20 Jul 2023 13:20:28 -0700 (PDT)
X-Received: by 2002:a9d:480a:0:b0:6b9:5bfc:9b33 with SMTP id
c10-20020a9d480a000000b006b95bfc9b33mr5401968otf.6.1689884427882; Thu, 20 Jul
2023 13:20:27 -0700 (PDT)
Path: i2pn2.org!i2pn.org!news.1d4.us!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Thu, 20 Jul 2023 13:20:27 -0700 (PDT)
In-Reply-To: <874jlyqsi1.fsf@bsb.me.uk>
Injection-Info: google-groups.googlegroups.com; posting-host=5.172.255.155; posting-account=Sb6m8goAAABbWsBL7gouk3bfLsuxwMgN
NNTP-Posting-Host: 5.172.255.155
References: <eb9e82fb-265b-42a7-a245-1943e5b3b5aan@googlegroups.com>
<87tttzr9h0.fsf@bsb.me.uk> <a0756188-052d-406b-8fe8-7c6a071be044n@googlegroups.com>
<874jlyqsi1.fsf@bsb.me.uk>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <60c604ee-8eb2-4748-abba-080c8a7e2faan@googlegroups.com>
Subject: Re: random points near central point
From: profesor...@gmail.com (fir)
Injection-Date: Thu, 20 Jul 2023 20:20:28 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3284
 by: fir - Thu, 20 Jul 2023 20:20 UTC

czwartek, 20 lipca 2023 o 21:43:02 UTC+2 Ben Bacarisse napisał(a):
> fir <profes...@gmail.com> writes:
>
> > środa, 19 lipca 2023 o 21:24:09 UTC+2 Ben Bacarisse napisał(a):
> >> fir <profes...@gmail.com> writes:
> >>
> >> > i need tos et asteroids in game (about 100 or 200) but not in square
> >> > area with two rands one for x and second for y but need it to
> >> > be sphericel symetric around central point and in more densitu near it
> >> > and less desity with bigger radius until some radius when it is zero
> >> If you just pick a uniform angle and a uniform radius and plot those
> >> points, the density of points near the origin will be higher. This is a
> >> very simple method and might be suitable for a game.
> >
> > uniform radius? dont know what is that
> Uniform refers to a statistical distribution with uniform density --
> every result in some range is equally likely. Your random number
> generator will have a function to give you a number uniformly
> distributed in some range (often >= 0.0 to < 1.0). I'll use drand48()
> as an example.
>
> double pi = 4 * atan(1);
> double r = drand48();
> double a = 2 * pi * drand48();
>
> Now if you plot the point at angle a and distance r from (0,0) you will
> see that they all lie in the unit circle but they cluster round the
> origin.
>
> Obviously you can convert polar coordinates r and a to Cartesian x and y
> with
>
> double x = r * cos(a), y = r * sin(a);
>
> I'm not sure if this is what you want, but it sounds like it from some
> of the words you used.
>

you mean hust getting random radius + random angle tend to do more density for smal radius - you may be right... i didnt get it in fiorst moment...yjere may be some problem though that it provides to high density near centra and here i need tio have flat density not linearly rise till zero

Re: random points near central point

<u9db6n$359g5$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=26416&group=comp.lang.c#26416

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: random points near central point
Date: Fri, 21 Jul 2023 09:13:27 +0200
Organization: A noiseless patient Spider
Lines: 60
Message-ID: <u9db6n$359g5$1@dont-email.me>
References: <eb9e82fb-265b-42a7-a245-1943e5b3b5aan@googlegroups.com>
<87tttzr9h0.fsf@bsb.me.uk>
<a0756188-052d-406b-8fe8-7c6a071be044n@googlegroups.com>
<874jlyqsi1.fsf@bsb.me.uk>
<2c181aeb-49e4-45b8-8be1-fc1189878e3en@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 21 Jul 2023 07:13:27 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="b2fb03a98f308a462982357442f9ec83";
logging-data="3319301"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX191JT1wUf1IuYznYLv1E/S3DiMcdzCvTKg="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.9.0
Cancel-Lock: sha1:7xZmnyFKt/fd6/QWSwY0c+VUKBI=
In-Reply-To: <2c181aeb-49e4-45b8-8be1-fc1189878e3en@googlegroups.com>
Content-Language: en-GB
 by: David Brown - Fri, 21 Jul 2023 07:13 UTC

On 20/07/2023 21:56, fir wrote:
> czwartek, 20 lipca 2023 o 21:43:02 UTC+2 Ben Bacarisse napisał(a):
>> fir <profes...@gmail.com> writes:
>>
>>> środa, 19 lipca 2023 o 21:24:09 UTC+2 Ben Bacarisse napisał(a):
>>>> fir <profes...@gmail.com> writes:
>>>>
>>>>> i need tos et asteroids in game (about 100 or 200) but not in square
>>>>> area with two rands one for x and second for y but need it to
>>>>> be sphericel symetric around central point and in more densitu near it
>>>>> and less desity with bigger radius until some radius when it is zero
>>>> If you just pick a uniform angle and a uniform radius and plot those
>>>> points, the density of points near the origin will be higher. This is a
>>>> very simple method and might be suitable for a game.
>>>
>>> uniform radius? dont know what is that
>> Uniform refers to a statistical distribution with uniform density --
>> every result in some range is equally likely. Your random number
>> generator will have a function to give you a number uniformly
>> distributed in some range (often >= 0.0 to < 1.0). I'll use drand48()
>> as an example.
>>
>> double pi = 4 * atan(1);
>> double r = drand48();
>> double a = 2 * pi * drand48();
>>
>> Now if you plot the point at angle a and distance r from (0,0) you will
>> see that they all lie in the unit circle but they cluster round the
>> origin.
>>
>> Obviously you can convert polar coordinates r and a to Cartesian x and y
>> with
>>
>> double x = r * cos(a), y = r * sin(a);
>>
>> I'm not sure if this is what you want, but it sounds like it from some
>> of the words you used.
>>
>
> no i just need to add rangom grou[p which is randomly spgerical amd has more density near centre and which get downs to zero at some radius R2
> the centre of it (with some radius R) should have some flat density ...iys not just much important what but flad
>
> say i need to put 200 asteroids around some point - in rhe radius say 500 meters they should have 100% density between radius 500 to 1000 metars the density should drop to 0%

const double outer_radius = 1000;
const double inner_radius = 1000;

const double pi = 4 * atan(1);

double distance_to_asteroid = drand48() * (outer_radius - inner_radius)
+ inner_radius;
double angle_in_radians = 2 * pi * drand48();

Does that help?

If not, I'm with Ben - if you want help, you'll have to explain the task
better, and explain why this won't work.

Re: random points near central point

<0c4b6149-511e-432c-a5b7-c7c88a865006n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=26433&group=comp.lang.c#26433

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a37:b883:0:b0:767:f102:e564 with SMTP id i125-20020a37b883000000b00767f102e564mr3761qkf.12.1689944127796;
Fri, 21 Jul 2023 05:55:27 -0700 (PDT)
X-Received: by 2002:a9d:664f:0:b0:6b9:4d78:cf07 with SMTP id
q15-20020a9d664f000000b006b94d78cf07mr3283044otm.7.1689944127380; Fri, 21 Jul
2023 05:55:27 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Fri, 21 Jul 2023 05:55:26 -0700 (PDT)
In-Reply-To: <u9db6n$359g5$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=5.172.255.108; posting-account=Sb6m8goAAABbWsBL7gouk3bfLsuxwMgN
NNTP-Posting-Host: 5.172.255.108
References: <eb9e82fb-265b-42a7-a245-1943e5b3b5aan@googlegroups.com>
<87tttzr9h0.fsf@bsb.me.uk> <a0756188-052d-406b-8fe8-7c6a071be044n@googlegroups.com>
<874jlyqsi1.fsf@bsb.me.uk> <2c181aeb-49e4-45b8-8be1-fc1189878e3en@googlegroups.com>
<u9db6n$359g5$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <0c4b6149-511e-432c-a5b7-c7c88a865006n@googlegroups.com>
Subject: Re: random points near central point
From: profesor...@gmail.com (fir)
Injection-Date: Fri, 21 Jul 2023 12:55:27 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 5353
 by: fir - Fri, 21 Jul 2023 12:55 UTC

piątek, 21 lipca 2023 o 09:15:59 UTC+2 David Brown napisał(a):
> On 20/07/2023 21:56, fir wrote:
> > czwartek, 20 lipca 2023 o 21:43:02 UTC+2 Ben Bacarisse napisał(a):
> >> fir <profes...@gmail.com> writes:
> >>
> >>> środa, 19 lipca 2023 o 21:24:09 UTC+2 Ben Bacarisse napisał(a):
> >>>> fir <profes...@gmail.com> writes:
> >>>>
> >>>>> i need tos et asteroids in game (about 100 or 200) but not in square
> >>>>> area with two rands one for x and second for y but need it to
> >>>>> be sphericel symetric around central point and in more densitu near it
> >>>>> and less desity with bigger radius until some radius when it is zero
> >>>> If you just pick a uniform angle and a uniform radius and plot those
> >>>> points, the density of points near the origin will be higher. This is a
> >>>> very simple method and might be suitable for a game.
> >>>
> >>> uniform radius? dont know what is that
> >> Uniform refers to a statistical distribution with uniform density --
> >> every result in some range is equally likely. Your random number
> >> generator will have a function to give you a number uniformly
> >> distributed in some range (often >= 0.0 to < 1.0). I'll use drand48()
> >> as an example.
> >>
> >> double pi = 4 * atan(1);
> >> double r = drand48();
> >> double a = 2 * pi * drand48();
> >>
> >> Now if you plot the point at angle a and distance r from (0,0) you will
> >> see that they all lie in the unit circle but they cluster round the
> >> origin.
> >>
> >> Obviously you can convert polar coordinates r and a to Cartesian x and y
> >> with
> >>
> >> double x = r * cos(a), y = r * sin(a);
> >>
> >> I'm not sure if this is what you want, but it sounds like it from some
> >> of the words you used.
> >>
> >
> > no i just need to add rangom grou[p which is randomly spgerical amd has more density near centre and which get downs to zero at some radius R2
> > the centre of it (with some radius R) should have some flat density ...iys not just much important what but flad
> >
> > say i need to put 200 asteroids around some point - in rhe radius say 500 meters they should have 100% density between radius 500 to 1000 metars the density should drop to 0%
> const double outer_radius = 1000;
> const double inner_radius = 1000;
>
> const double pi = 4 * atan(1);
>
> double distance_to_asteroid = drand48() * (outer_radius - inner_radius)
> + inner_radius;
> double angle_in_radians = 2 * pi * drand48();
>
> Does that help?
>
> If not, I'm with Ben - if you want help, you'll have to explain the task
> better, and explain why this won't work.

help is wrong word here i state topic, as opportunity to say something, dont need help
in a strict sense of this world - one need help if has a serious problem he cant overcome and
that kind of things is not like that

btw better write int rand2(int min, int max) function as i do, using this naked form is generally stupid imo

no i dont want to put an asteroid in 'cylinder' from radius r1 to r2
i want to set most of them in circle r1 and rest in cylinder from r1 to r2 such way it would look naturally such as a n group of astronomical things or pieces of things when you shatter them on the floor - most density in the centre till r1 less near r2 and none outside r2

this one with just
for(int i=0; i<200;i++) { r = rand2(r1,r2); a = rand2(1,360); }

i yet not tested but i got a feeling it isnt enough good (will test in evening)
probably something like said

for(float r=r2; i<r1; r-=(r2-r1)/200.)
{
PutRandomInCurcle(z,y,r);
}

could be somewhat better (It puts random in circle which is shrinking thus the edges will have less then centre

Re: random points near central point

<70c10615-2473-4f66-ab1c-c632aa33fa5cn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=26513&group=comp.lang.c#26513

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:622a:1827:b0:403:f563:30e1 with SMTP id t39-20020a05622a182700b00403f56330e1mr14812qtc.10.1690053855783;
Sat, 22 Jul 2023 12:24:15 -0700 (PDT)
X-Received: by 2002:a05:6808:1b0b:b0:3a0:3d3c:1f03 with SMTP id
bx11-20020a0568081b0b00b003a03d3c1f03mr10069740oib.11.1690053855474; Sat, 22
Jul 2023 12:24:15 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Sat, 22 Jul 2023 12:24:15 -0700 (PDT)
In-Reply-To: <0c4b6149-511e-432c-a5b7-c7c88a865006n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:5f82:5000:f1f2:a13a:10ef:2ba;
posting-account=3ty6FAkAAACYEfch20jQ1ZACFatw-Vdx
NNTP-Posting-Host: 2600:1700:5f82:5000:f1f2:a13a:10ef:2ba
References: <eb9e82fb-265b-42a7-a245-1943e5b3b5aan@googlegroups.com>
<87tttzr9h0.fsf@bsb.me.uk> <a0756188-052d-406b-8fe8-7c6a071be044n@googlegroups.com>
<874jlyqsi1.fsf@bsb.me.uk> <2c181aeb-49e4-45b8-8be1-fc1189878e3en@googlegroups.com>
<u9db6n$359g5$1@dont-email.me> <0c4b6149-511e-432c-a5b7-c7c88a865006n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <70c10615-2473-4f66-ab1c-c632aa33fa5cn@googlegroups.com>
Subject: Re: random points near central point
From: edproc...@gmail.com (Ed Prochak)
Injection-Date: Sat, 22 Jul 2023 19:24:15 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Ed Prochak - Sat, 22 Jul 2023 19:24 UTC

On Friday, July 21, 2023 at 8:55:36 AM UTC-4, fir wrote:
[]
> no i dont want to put an asteroid in 'cylinder' from radius r1 to r2
> i want to set most of them in circle r1 and rest in cylinder from r1 to r2
> such way it would look naturally such as a n group of astronomical things
> or pieces of things when you shatter them on the floor - most density in
> the centre till r1 less near r2 and none outside r2
>
I suggest you define your expected distribution first.
You might begin by defining the distribution you really want.
case 1: Is it constant density from 0 to r1 and then linear decline of density from r` to r2?
case 2: is is a natural distribution of "astronomical things"?
(clearly not like case 1, consider the solar system, including the asteroid belt)
case 3: is it a random scattering as "when you shatter them on the floor"
(clearly not like case 1 or 2. This is a gaussian distribution.)
case 4: SOMETHING ELSE???

State your desire clearly and we may be able to help you. Without a clear goal,
you'll be debugging potential solutions forever.

Ed

Re: random points near central point

<f95fe6e8-b77b-42ba-a3d9-78057e1101c0n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=26544&group=comp.lang.c#26544

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:ac8:5f92:0:b0:403:edaf:5b78 with SMTP id j18-20020ac85f92000000b00403edaf5b78mr17786qta.6.1690110285483;
Sun, 23 Jul 2023 04:04:45 -0700 (PDT)
X-Received: by 2002:a05:6870:5b19:b0:1ba:50ed:9ed6 with SMTP id
ds25-20020a0568705b1900b001ba50ed9ed6mr9064402oab.2.1690110285323; Sun, 23
Jul 2023 04:04:45 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Sun, 23 Jul 2023 04:04:44 -0700 (PDT)
In-Reply-To: <70c10615-2473-4f66-ab1c-c632aa33fa5cn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=5.172.255.243; posting-account=Sb6m8goAAABbWsBL7gouk3bfLsuxwMgN
NNTP-Posting-Host: 5.172.255.243
References: <eb9e82fb-265b-42a7-a245-1943e5b3b5aan@googlegroups.com>
<87tttzr9h0.fsf@bsb.me.uk> <a0756188-052d-406b-8fe8-7c6a071be044n@googlegroups.com>
<874jlyqsi1.fsf@bsb.me.uk> <2c181aeb-49e4-45b8-8be1-fc1189878e3en@googlegroups.com>
<u9db6n$359g5$1@dont-email.me> <0c4b6149-511e-432c-a5b7-c7c88a865006n@googlegroups.com>
<70c10615-2473-4f66-ab1c-c632aa33fa5cn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <f95fe6e8-b77b-42ba-a3d9-78057e1101c0n@googlegroups.com>
Subject: Re: random points near central point
From: profesor...@gmail.com (fir)
Injection-Date: Sun, 23 Jul 2023 11:04:45 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3571
 by: fir - Sun, 23 Jul 2023 11:04 UTC

sobota, 22 lipca 2023 o 21:24:23 UTC+2 Ed Prochak napisał(a):
> On Friday, July 21, 2023 at 8:55:36 AM UTC-4, fir wrote:
> []
> > no i dont want to put an asteroid in 'cylinder' from radius r1 to r2
> > i want to set most of them in circle r1 and rest in cylinder from r1 to r2
> > such way it would look naturally such as a n group of astronomical things
> > or pieces of things when you shatter them on the floor - most density in
> > the centre till r1 less near r2 and none outside r2
> >
> I suggest you define your expected distribution first.
> You might begin by defining the distribution you really want.
> case 1: Is it constant density from 0 to r1 and then linear decline of density from r` to r2?
> case 2: is is a natural distribution of "astronomical things"?
> (clearly not like case 1, consider the solar system, including the asteroid belt)
> case 3: is it a random scattering as "when you shatter them on the floor"
> (clearly not like case 1 or 2. This is a gaussian distribution.)
> case 4: SOMETHING ELSE???
>
> State your desire clearly and we may be able to help you. Without a clear goal,
> you'll be debugging potential solutions forever.
>
> Ed

i dont care to much exactly i need to set a pack of 200 asteroids around some point to look good (but this should be not to much density in centre, ilke 10 asteroid cover the same piece of screen, thety may cover partially, but not like stack in 10 in one place)...also i want to use this function to set other things like in random group (but not like brush in pain, its more like more density in centre (where centre is not point but circle) and gradually less from r1 to r2

i think its not hard to understand what i want

in fact i may need more on this like some function tos et random 'stars' points in color/colors to make something that would look like nice looking photographs of galexies, making nice looking random groups (for a use of 2d cosmic space game)

Re: random points near central point

<87fs5en385.fsf@bsb.me.uk>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=26559&group=comp.lang.c#26559

  copy link   Newsgroups: comp.lang.c comp.programming
Followup: comp.programming
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ben.use...@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.lang.c,comp.programming
Subject: Re: random points near central point
Followup-To: comp.programming
Date: Sun, 23 Jul 2023 14:53:46 +0100
Organization: A noiseless patient Spider
Lines: 46
Message-ID: <87fs5en385.fsf@bsb.me.uk>
References: <eb9e82fb-265b-42a7-a245-1943e5b3b5aan@googlegroups.com>
<87tttzr9h0.fsf@bsb.me.uk>
<a0756188-052d-406b-8fe8-7c6a071be044n@googlegroups.com>
<874jlyqsi1.fsf@bsb.me.uk>
<2c181aeb-49e4-45b8-8be1-fc1189878e3en@googlegroups.com>
<u9db6n$359g5$1@dont-email.me>
<0c4b6149-511e-432c-a5b7-c7c88a865006n@googlegroups.com>
<70c10615-2473-4f66-ab1c-c632aa33fa5cn@googlegroups.com>
<f95fe6e8-b77b-42ba-a3d9-78057e1101c0n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: dont-email.me; posting-host="46eee68be2a45be2a6fdd3ba499a7b10";
logging-data="295049"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19XvSd1tGP7oHY4K1V8Vo2ovYDsDOMYEjk="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:OWg5nFpO7W6wL/6qkKZORI/9pPk=
sha1:iHGJaM25uf4CnNcIB/1Ecsf/eG8=
X-BSB-Auth: 1.2e4158c84944d26a49aa.20230723145346BST.87fs5en385.fsf@bsb.me.uk
 by: Ben Bacarisse - Sun, 23 Jul 2023 13:53 UTC

fir <profesor.fir@gmail.com> writes:

> sobota, 22 lipca 2023 o 21:24:23 UTC+2 Ed Prochak napisał(a):
>> On Friday, July 21, 2023 at 8:55:36 AM UTC-4, fir wrote:
>> []
>> > no i dont want to put an asteroid in 'cylinder' from radius r1 to r2
>> > i want to set most of them in circle r1 and rest in cylinder from r1 to r2
>> > such way it would look naturally such as a n group of astronomical things
>> > or pieces of things when you shatter them on the floor - most density in
>> > the centre till r1 less near r2 and none outside r2
>> >
>> I suggest you define your expected distribution first.
>> You might begin by defining the distribution you really want.
>> case 1: Is it constant density from 0 to r1 and then linear decline of density from r` to r2?
>> case 2: is is a natural distribution of "astronomical things"?
>> (clearly not like case 1, consider the solar system, including the asteroid belt)
>> case 3: is it a random scattering as "when you shatter them on the floor"
>> (clearly not like case 1 or 2. This is a gaussian distribution.)
>> case 4: SOMETHING ELSE???
>>
>> State your desire clearly and we may be able to help you. Without a clear goal,
>> you'll be debugging potential solutions forever.
>>
>> Ed
>
> i dont care to much exactly i need to set a pack of 200 asteroids
> around some point to look good (but this should be not to much density
> in centre, ilke 10 asteroid cover the same piece of screen, thety may
> cover partially, but not like stack in 10 in one place)...also i want
> to use this function to set other things like in random group (but not
> like brush in pain, its more like more density in centre (where centre
> is not point but circle) and gradually less from r1 to r2

A bit like these:

http://bsb.me.uk/tmp/r1.png
http://bsb.me.uk/tmp/r2.png

> i think its not hard to understand what i want

It's hard to understand what you write. I am sure what you want is
quite simple. This is not about C so I'm going to crosspost to
comp.programming and set followups. I won't post about it here again.

--
Ben.

Re: random points near central point

<0ede2619-63a3-4f1f-aad3-4c4c91ae3e22n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=26561&group=comp.lang.c#26561

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:6214:921:b0:635:db54:4885 with SMTP id dk1-20020a056214092100b00635db544885mr30965qvb.4.1690121022503;
Sun, 23 Jul 2023 07:03:42 -0700 (PDT)
X-Received: by 2002:a05:6870:703:b0:1bb:6267:9c42 with SMTP id
ea3-20020a056870070300b001bb62679c42mr1363527oab.0.1690121022182; Sun, 23 Jul
2023 07:03:42 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Sun, 23 Jul 2023 07:03:41 -0700 (PDT)
In-Reply-To: <87fs5en385.fsf@bsb.me.uk>
Injection-Info: google-groups.googlegroups.com; posting-host=5.172.255.59; posting-account=Sb6m8goAAABbWsBL7gouk3bfLsuxwMgN
NNTP-Posting-Host: 5.172.255.59
References: <eb9e82fb-265b-42a7-a245-1943e5b3b5aan@googlegroups.com>
<87tttzr9h0.fsf@bsb.me.uk> <a0756188-052d-406b-8fe8-7c6a071be044n@googlegroups.com>
<874jlyqsi1.fsf@bsb.me.uk> <2c181aeb-49e4-45b8-8be1-fc1189878e3en@googlegroups.com>
<u9db6n$359g5$1@dont-email.me> <0c4b6149-511e-432c-a5b7-c7c88a865006n@googlegroups.com>
<70c10615-2473-4f66-ab1c-c632aa33fa5cn@googlegroups.com> <f95fe6e8-b77b-42ba-a3d9-78057e1101c0n@googlegroups.com>
<87fs5en385.fsf@bsb.me.uk>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <0ede2619-63a3-4f1f-aad3-4c4c91ae3e22n@googlegroups.com>
Subject: Re: random points near central point
From: profesor...@gmail.com (fir)
Injection-Date: Sun, 23 Jul 2023 14:03:42 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 4715
 by: fir - Sun, 23 Jul 2023 14:03 UTC

niedziela, 23 lipca 2023 o 15:54:01 UTC+2 Ben Bacarisse napisał(a):
> fir <profes...@gmail.com> writes:
>
> > sobota, 22 lipca 2023 o 21:24:23 UTC+2 Ed Prochak napisał(a):
> >> On Friday, July 21, 2023 at 8:55:36 AM UTC-4, fir wrote:
> >> []
> >> > no i dont want to put an asteroid in 'cylinder' from radius r1 to r2
> >> > i want to set most of them in circle r1 and rest in cylinder from r1 to r2
> >> > such way it would look naturally such as a n group of astronomical things
> >> > or pieces of things when you shatter them on the floor - most density in
> >> > the centre till r1 less near r2 and none outside r2
> >> >
> >> I suggest you define your expected distribution first.
> >> You might begin by defining the distribution you really want.
> >> case 1: Is it constant density from 0 to r1 and then linear decline of density from r` to r2?
> >> case 2: is is a natural distribution of "astronomical things"?
> >> (clearly not like case 1, consider the solar system, including the asteroid belt)
> >> case 3: is it a random scattering as "when you shatter them on the floor"
> >> (clearly not like case 1 or 2. This is a gaussian distribution.)
> >> case 4: SOMETHING ELSE???
> >>
> >> State your desire clearly and we may be able to help you. Without a clear goal,
> >> you'll be debugging potential solutions forever.
> >>
> >> Ed
> >
> > i dont care to much exactly i need to set a pack of 200 asteroids
> > around some point to look good (but this should be not to much density
> > in centre, ilke 10 asteroid cover the same piece of screen, thety may
> > cover partially, but not like stack in 10 in one place)...also i want
> > to use this function to set other things like in random group (but not
> > like brush in pain, its more like more density in centre (where centre
> > is not point but circle) and gradually less from r1 to r2
> A bit like these:
>
> http://bsb.me.uk/tmp/r1.png
> http://bsb.me.uk/tmp/r2.png
> > i think its not hard to understand what i want
> It's hard to understand what you write. I am sure what you want is
> quite simple. This is not about C so I'm going to crosspost to
> comp.programming and set followups. I won't post about it here again.
>

you drawed circle, i need not such empty circle but "filled circle" jest on thsi edges i need it vanishes slower - besides something like that

you know there are two opitions
1) thsi group be talked on c language (to narrow imo)
2) on programmming in c (its imo obvious that thsi group also should be on programming in c)

so you may write on this if you have nothing better to do.. or you may not as you will... I personally dont like to be bored so if i get back to use some group i prefer to post a lot of posts not to be bored than not many and get bored - and thsi group is not much floded with interesting topics..thats why i trather think posting it is more good than bad.. sooon i will vanis again for months at least i guess

Re: random points near central point

<u9jv0j$b0q1$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=26580&group=comp.lang.c#26580

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c
Subject: Re: random points near central point
Date: Sun, 23 Jul 2023 12:28:18 -0700
Organization: A noiseless patient Spider
Lines: 28
Message-ID: <u9jv0j$b0q1$1@dont-email.me>
References: <eb9e82fb-265b-42a7-a245-1943e5b3b5aan@googlegroups.com>
<87tttzr9h0.fsf@bsb.me.uk>
<a0756188-052d-406b-8fe8-7c6a071be044n@googlegroups.com>
<u9c3iv$2rpbs$2@dont-email.me>
<64228552-63a4-45b2-b332-b29d05967707n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 23 Jul 2023 19:28:19 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="e8c4c7a86f01995a646e7445e7dc0229";
logging-data="361281"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19WsPm6JVAo5VErgRcdOMi2qFQOfXw16CY="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Cancel-Lock: sha1:lllSaDVY8AXQS/lFQ6nxXZ4YVs0=
In-Reply-To: <64228552-63a4-45b2-b332-b29d05967707n@googlegroups.com>
Content-Language: en-US
 by: Chris M. Thomasson - Sun, 23 Jul 2023 19:28 UTC

On 7/20/2023 1:18 PM, fir wrote:
> czwartek, 20 lipca 2023 o 21:57:33 UTC+2 Chris M. Thomasson napisał(a):
>> On 7/20/2023 9:31 AM, fir wrote:
>>>>> how to do that?
>> Random angles and random radii that are locked in the unit circle?
>> Should be good enough?
>
> i dont know maybe randomize in circle of R2 then in some steps randomize in smaller circle until i reach R1 ?
>
> there should be some easy methods i guess..hovevver im not sur if geting random in polar coordinates gives really random in 2d space...maybe its natorally more density near centre then?

Create the random angles and random radii locked in a circle. Lets start
small with a unit circle centered at origin {0, 0}. Just plot the
points. Convert the polar form to rectangular, and plot the points
during iteration. For each iteration create a random radius from 0...1
and a random angle from 0...pi2:

vec2 r0_normal = { cos(random_angle), sin(random_angle) };

vec2 r0 = origin + r0_normal * random_radius;

plot(r0);

Should be okay enough?

Re: random points near central point

<u9jv53$b0q1$2@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=26581&group=comp.lang.c#26581

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c
Subject: Re: random points near central point
Date: Sun, 23 Jul 2023 12:30:43 -0700
Organization: A noiseless patient Spider
Lines: 70
Message-ID: <u9jv53$b0q1$2@dont-email.me>
References: <eb9e82fb-265b-42a7-a245-1943e5b3b5aan@googlegroups.com>
<87tttzr9h0.fsf@bsb.me.uk>
<a0756188-052d-406b-8fe8-7c6a071be044n@googlegroups.com>
<874jlyqsi1.fsf@bsb.me.uk>
<2c181aeb-49e4-45b8-8be1-fc1189878e3en@googlegroups.com>
<u9db6n$359g5$1@dont-email.me>
<0c4b6149-511e-432c-a5b7-c7c88a865006n@googlegroups.com>
<70c10615-2473-4f66-ab1c-c632aa33fa5cn@googlegroups.com>
<f95fe6e8-b77b-42ba-a3d9-78057e1101c0n@googlegroups.com>
<87fs5en385.fsf@bsb.me.uk>
<0ede2619-63a3-4f1f-aad3-4c4c91ae3e22n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 23 Jul 2023 19:30:44 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="e8c4c7a86f01995a646e7445e7dc0229";
logging-data="361281"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19E7zmzVdIhILroujcMvgAuCZ2YLeze2XY="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Cancel-Lock: sha1:pPpjdKr1I6LK7RbRBNtEFjTcwjc=
In-Reply-To: <0ede2619-63a3-4f1f-aad3-4c4c91ae3e22n@googlegroups.com>
Content-Language: en-US
 by: Chris M. Thomasson - Sun, 23 Jul 2023 19:30 UTC

On 7/23/2023 7:03 AM, fir wrote:
> niedziela, 23 lipca 2023 o 15:54:01 UTC+2 Ben Bacarisse napisał(a):
>> fir <profes...@gmail.com> writes:
>>
>>> sobota, 22 lipca 2023 o 21:24:23 UTC+2 Ed Prochak napisał(a):
>>>> On Friday, July 21, 2023 at 8:55:36 AM UTC-4, fir wrote:
>>>> []
>>>>> no i dont want to put an asteroid in 'cylinder' from radius r1 to r2
>>>>> i want to set most of them in circle r1 and rest in cylinder from r1 to r2
>>>>> such way it would look naturally such as a n group of astronomical things
>>>>> or pieces of things when you shatter them on the floor - most density in
>>>>> the centre till r1 less near r2 and none outside r2
>>>>>
>>>> I suggest you define your expected distribution first.
>>>> You might begin by defining the distribution you really want.
>>>> case 1: Is it constant density from 0 to r1 and then linear decline of density from r` to r2?
>>>> case 2: is is a natural distribution of "astronomical things"?
>>>> (clearly not like case 1, consider the solar system, including the asteroid belt)
>>>> case 3: is it a random scattering as "when you shatter them on the floor"
>>>> (clearly not like case 1 or 2. This is a gaussian distribution.)
>>>> case 4: SOMETHING ELSE???
>>>>
>>>> State your desire clearly and we may be able to help you. Without a clear goal,
>>>> you'll be debugging potential solutions forever.
>>>>
>>>> Ed
>>>
>>> i dont care to much exactly i need to set a pack of 200 asteroids
>>> around some point to look good (but this should be not to much density
>>> in centre, ilke 10 asteroid cover the same piece of screen, thety may
>>> cover partially, but not like stack in 10 in one place)...also i want
>>> to use this function to set other things like in random group (but not
>>> like brush in pain, its more like more density in centre (where centre
>>> is not point but circle) and gradually less from r1 to r2
>> A bit like these:
>>
>> http://bsb.me.uk/tmp/r1.png
>> http://bsb.me.uk/tmp/r2.png
>>> i think its not hard to understand what i want
>> It's hard to understand what you write. I am sure what you want is
>> quite simple. This is not about C so I'm going to crosspost to
>> comp.programming and set followups. I won't post about it here again.
>>
>
> you drawed circle, i need not such empty circle but "filled circle" jest on thsi edges i need it vanishes slower - besides something like that
>
> you know there are two opitions
> 1) thsi group be talked on c language (to narrow imo)
> 2) on programmming in c (its imo obvious that thsi group also should be on programming in c)
>
> so you may write on this if you have nothing better to do.. or you may not as you will... I personally dont like to be bored so if i get back to use some group i prefer to post a lot of posts not to be bored than not many and get bored - and thsi group is not much floded with interesting topics..thats why i trather think posting it is more good than bad.. sooon i will vanis again for months at least i guess

Create the random angles and random radii locked in a circle. Lets start
small with a unit circle centered at origin {0, 0}. Just plot the
points. Convert the polar form to rectangular, and plot the points
during iteration. For each iteration create a random radius from 0...1
and a random angle from 0...pi2:

vec2 r0_normal = { cos(random_angle), sin(random_angle) };

vec2 r0 = origin + r0_normal * random_radius;

plot(r0);

Should be okay enough?

It will fill in the unit circle at origin (0, 0), and radius 1.

The random radius would go from 0...max_radius, for the unit circle
max_radius is one.

Re: random points near central point

<acd923a1-64cf-4d2e-b599-552936b84c04n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=26854&group=comp.lang.c#26854

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:620a:3a45:b0:767:b47b:1451 with SMTP id sk5-20020a05620a3a4500b00767b47b1451mr47082qkn.0.1690778885593;
Sun, 30 Jul 2023 21:48:05 -0700 (PDT)
X-Received: by 2002:a4a:d5c6:0:b0:563:356f:5f91 with SMTP id
a6-20020a4ad5c6000000b00563356f5f91mr12729885oot.0.1690778885363; Sun, 30 Jul
2023 21:48:05 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Sun, 30 Jul 2023 21:48:05 -0700 (PDT)
In-Reply-To: <f95fe6e8-b77b-42ba-a3d9-78057e1101c0n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:5f82:5000:545a:2982:9d74:ecff;
posting-account=3ty6FAkAAACYEfch20jQ1ZACFatw-Vdx
NNTP-Posting-Host: 2600:1700:5f82:5000:545a:2982:9d74:ecff
References: <eb9e82fb-265b-42a7-a245-1943e5b3b5aan@googlegroups.com>
<87tttzr9h0.fsf@bsb.me.uk> <a0756188-052d-406b-8fe8-7c6a071be044n@googlegroups.com>
<874jlyqsi1.fsf@bsb.me.uk> <2c181aeb-49e4-45b8-8be1-fc1189878e3en@googlegroups.com>
<u9db6n$359g5$1@dont-email.me> <0c4b6149-511e-432c-a5b7-c7c88a865006n@googlegroups.com>
<70c10615-2473-4f66-ab1c-c632aa33fa5cn@googlegroups.com> <f95fe6e8-b77b-42ba-a3d9-78057e1101c0n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <acd923a1-64cf-4d2e-b599-552936b84c04n@googlegroups.com>
Subject: Re: random points near central point
From: edproc...@gmail.com (Ed Prochak)
Injection-Date: Mon, 31 Jul 2023 04:48:05 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3516
 by: Ed Prochak - Mon, 31 Jul 2023 04:48 UTC

On Sunday, July 23, 2023 at 7:04:54 AM UTC-4, fir wrote:
> sobota, 22 lipca 2023 o 21:24:23 UTC+2 Ed Prochak napisał(a):
> > On Friday, July 21, 2023 at 8:55:36 AM UTC-4, fir wrote:
> > []
> > > no i dont want to put an asteroid in 'cylinder' from radius r1 to r2
> > > i want to set most of them in circle r1 and rest in cylinder from r1 to r2
> > > such way it would look naturally such as a n group of astronomical things
> > > or pieces of things when you shatter them on the floor - most density in
> > > the centre till r1 less near r2 and none outside r2
> > >
> > I suggest you define your expected distribution first.
> > You might begin by defining the distribution you really want.
> > case 1: Is it constant density from 0 to r1 and then linear decline of density from r` to r2?
> > case 2: is is a natural distribution of "astronomical things"?
> > (clearly not like case 1, consider the solar system, including the asteroid belt)
> > case 3: is it a random scattering as "when you shatter them on the floor"
> > (clearly not like case 1 or 2. This is a gaussian distribution.)
> > case 4: SOMETHING ELSE???
> >
> > State your desire clearly and we may be able to help you. Without a clear goal,
> > you'll be debugging potential solutions forever.
> >
> > Ed
> i dont care to much exactly
[]
I gave you a list, you seem to want case 4.
I don't have an answer for you in this case.

>
> in fact i may need more on this like some function tos et random
> 'stars' points in color/colors to make something that would look
> like nice looking photographs of galexies, making nice looking
> random groups (for a use of 2d cosmic space game)

So write some code to attempt this. test it and see how it works.
You keep changing what you want to I'm done.

Bye
Ed

Re: random points near central point

<b53e574a-2a9f-4b70-9ef1-5d08f039f0ban@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=26970&group=comp.lang.c#26970

  copy link   Newsgroups: comp.lang.c
X-Received: by 2002:a05:6214:1845:b0:635:b679:a365 with SMTP id d5-20020a056214184500b00635b679a365mr87342qvy.0.1691082126728;
Thu, 03 Aug 2023 10:02:06 -0700 (PDT)
X-Received: by 2002:a05:6808:159c:b0:3a7:75cd:df40 with SMTP id
t28-20020a056808159c00b003a775cddf40mr425102oiw.7.1691082004698; Thu, 03 Aug
2023 10:00:04 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c
Date: Thu, 3 Aug 2023 10:00:04 -0700 (PDT)
In-Reply-To: <acd923a1-64cf-4d2e-b599-552936b84c04n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=5.172.255.221; posting-account=Sb6m8goAAABbWsBL7gouk3bfLsuxwMgN
NNTP-Posting-Host: 5.172.255.221
References: <eb9e82fb-265b-42a7-a245-1943e5b3b5aan@googlegroups.com>
<87tttzr9h0.fsf@bsb.me.uk> <a0756188-052d-406b-8fe8-7c6a071be044n@googlegroups.com>
<874jlyqsi1.fsf@bsb.me.uk> <2c181aeb-49e4-45b8-8be1-fc1189878e3en@googlegroups.com>
<u9db6n$359g5$1@dont-email.me> <0c4b6149-511e-432c-a5b7-c7c88a865006n@googlegroups.com>
<70c10615-2473-4f66-ab1c-c632aa33fa5cn@googlegroups.com> <f95fe6e8-b77b-42ba-a3d9-78057e1101c0n@googlegroups.com>
<acd923a1-64cf-4d2e-b599-552936b84c04n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <b53e574a-2a9f-4b70-9ef1-5d08f039f0ban@googlegroups.com>
Subject: Re: random points near central point
From: profesor...@gmail.com (fir)
Injection-Date: Thu, 03 Aug 2023 17:02:06 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: fir - Thu, 3 Aug 2023 17:00 UTC

poniedziałek, 31 lipca 2023 o 06:48:15 UTC+2 Ed Prochak napisał(a):
> On Sunday, July 23, 2023 at 7:04:54 AM UTC-4, fir wrote:
> > sobota, 22 lipca 2023 o 21:24:23 UTC+2 Ed Prochak napisał(a):
> > > On Friday, July 21, 2023 at 8:55:36 AM UTC-4, fir wrote:
> > > []
> > > > no i dont want to put an asteroid in 'cylinder' from radius r1 to r2
> > > > i want to set most of them in circle r1 and rest in cylinder from r1 to r2
> > > > such way it would look naturally such as a n group of astronomical things
> > > > or pieces of things when you shatter them on the floor - most density in
> > > > the centre till r1 less near r2 and none outside r2
> > > >
> > > I suggest you define your expected distribution first.
> > > You might begin by defining the distribution you really want.
> > > case 1: Is it constant density from 0 to r1 and then linear decline of density from r` to r2?
> > > case 2: is is a natural distribution of "astronomical things"?
> > > (clearly not like case 1, consider the solar system, including the asteroid belt)
> > > case 3: is it a random scattering as "when you shatter them on the floor"
> > > (clearly not like case 1 or 2. This is a gaussian distribution.)
> > > case 4: SOMETHING ELSE???
> > >
> > > State your desire clearly and we may be able to help you. Without a clear goal,
> > > you'll be debugging potential solutions forever.
> > >
> > > Ed
> > i dont care to much exactly
> []
> I gave you a list, you seem to want case 4.
> I don't have an answer for you in this case.
> >
> > in fact i may need more on this like some function tos et random
> > 'stars' points in color/colors to make something that would look
> > like nice looking photographs of galexies, making nice looking
> > random groups (for a use of 2d cosmic space game)
> So write some code to attempt this. test it and see how it works.
> You keep changing what you want to I'm done.
>
im not changing i just want some effect and it means no neccessary strict description of it

as to abowe i want 1 or 3 or 4 or 2 depending what you mean

i simply want to set N 'dots' around some {x,y} this way it look lrandim but "naturally" grouped
but i dont know the description...in fact this probably may be seen as 1 dimensional prolem
io now think - as you may combine two one-dimensional to obtain the effect

if you would use for(1000) {x= rand1(-100,100); SetAt(x)} then the distribution (i mean density) would be
rectangle: 0 density till -100, linerar density (of 1000/200) in betweem -100,100 then sero density for 100+
again

but how to properly obtain density that shapes triangle or 'hill'?

Re: random points near central point

<uagne8$rfjo$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=26971&group=comp.lang.c#26971

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c
Subject: Re: random points near central point
Date: Thu, 3 Aug 2023 19:17:01 +0200
Organization: A noiseless patient Spider
Lines: 41
Message-ID: <uagne8$rfjo$1@dont-email.me>
References: <eb9e82fb-265b-42a7-a245-1943e5b3b5aan@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 3 Aug 2023 17:16:56 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="6d6015b0c560a793f748962c15e51d2b";
logging-data="900728"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19VwangI4ekl8dP/zbR2tu52CWPoqawjSU="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:cwgzQbHKR6IJ1/5S/5JwTLlW/nA=
Content-Language: de-DE
In-Reply-To: <eb9e82fb-265b-42a7-a245-1943e5b3b5aan@googlegroups.com>
 by: Bonita Montero - Thu, 3 Aug 2023 17:17 UTC

Am 19.07.2023 um 08:38 schrieb fir:
> i need tos et asteroids in game (about 100 or 200) but not in square
> area with two rands one for x and second for y but need it to
> be sphericel symetric around central point and in more densitu near it and less desity with bigger radius until some radius when it is zero
>
> something like
>
> SetRandomPointSphericalSymetricAndFadingWithDistance(
> float x, float y, float r1, float r2);
>
> this r1 is radius of circle below which density is max and r2 is radius
> where above density is zero - in beetweem r1 and r2 density should
> be from max (at r1) to zero at r2
>
> how to do that?

In C++ I'd do that this way:

#include <random>
#include <cmath>

using namespace std;

double nearDistance( double d )
{ thread_local double exp = 2.0;
thread_local mt19937_64 mt;
thread_local uniform_real_distribution<double> rnd1( 0.0, 1.0 );
if( d < 0.0 ) [[unlikely]]
{
double beforeExp = exp;
exp = -d;
return beforeExp;
}
return pow( rnd1( mt ), exp ) * d;
}

This gives values from 0.0 to d which are more likely to be near
to 0.0 than with a linear exponent. The exponent can be changed
and should be > 1.0.

Pages:12
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor