![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Larry Fontaine wrote:
>
> How can I get a smooth random number, ie, it varies from the last random
> number by no more than a certain amount? (I'm making a tree macro and
> want a way to twist the limbs.)
I'll send you a possible solution by email. I would post the source but
it's a bit longish for this group.
--
Ken Tyler
1100+ Povray, Graphics, 3D Rendering, and Raytracing Links:
http://home.pacbell.net/tylereng/index.html
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
On Sat, 09 Oct 1999 22:32:33 -0500, Larry Fontaine <lfo### [at] isd net>
wrote:
>How can I get a smooth random number, ie, it varies from the last random
>number by no more than a certain amount? (I'm making a tree macro and
>want a way to twist the limbs.)
There's a smooth random generator in the Throroughly Useful Macros by
John VanSickle. Search Ken's links :)
Peter Popov
ICQ: 15002700
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Peter Popov wrote:
>
> On Sat, 09 Oct 1999 22:32:33 -0500, Larry Fontaine <lfo### [at] isd net>
> wrote:
>
> >How can I get a smooth random number, ie, it varies from the last random
> >number by no more than a certain amount? (I'm making a tree macro and
> >want a way to twist the limbs.)
>
> There's a smooth random generator in the Throroughly Useful Macros by
> John VanSickle. Search Ken's links :)
>
> Peter Popov
> ICQ: 15002700
I already sent it to him :)
--
Ken Tyler - 1100+ Povray, Graphics, 3D Rendering, and Raytracing Links:
http://home.pacbell.net/tylereng/index.html http://www.povray.org/links/
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
I'm not sure what you're after. The smooth rand macro is one solution.
I can also send you a Perlin noise macro I created. It takes a float as the
parameter and returns values within a certain limit. Close parameters give
statistically close values. The result is similar to turbulence - you have
control over octaves and omega - but the noise is 1D, i.e. it returns a float.
Let me know if you're interested, because I'd have to clean up the source before
posting it.
Margus
Larry Fontaine wrote:
>
> How can I get a smooth random number, ie, it varies from the last random
> number by no more than a certain amount? (I'm making a tree macro and
> want a way to twist the limbs.)
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Larry Fontaine <lfo### [at] isd net> wrote:
: How can I get a smooth random number, ie, it varies from the last random
: number by no more than a certain amount?
If you mean a linear distribution, that's pretty simple:
#declare Seed = seed(0);
#declare Number = rand(Seed);
#macro NextNumber(maxvariation)
#declare Number = Number-maxVariation+maxvariation*rand(Seed)*2;
Number
#end
--
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Nieminen Juha wrote:
>
> If you mean a linear distribution, that's pretty simple:
>
AFAIK, this is normal distribution.
I made two little macros that do normal distribution for floats and 3D vectors
(it's trivial to extend it to nD vectors). They take the mean, the maximum
deviation and a predeclared seed as parameters.
The macros are available from the Macroscope (rand_ext and v_rand_ext)
Margus
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Margus Ramst <mar### [at] peak edu ee> wrote:
: AFAIK, this is normal distribution.
No, normal distribution is distributed in the form e^(-x^2). You can get
an approximation by calculating the average of at least three random numbers
(the more the numbers, the better the approximation, but three is usually
close enough).
--
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Nieminen Juha wrote:
>
> Margus Ramst <mar### [at] peak edu ee> wrote:
> : AFAIK, this is normal distribution.
>
> No, normal distribution is distributed in the form e^(-x^2). You can get
> an approximation by calculating the average of at least three random numbers
> (the more the numbers, the better the approximation, but three is usually
> close enough).
>
The more random numbers summed, the smaller the standard deviation.
PoD.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
PoD wrote:
>
> The more random numbers summed, the smaller the standard deviation.
> PoD.
But that's just a relative measure, anyway. You can increase dispersion by
scaling with the mean as the origin.
Margus
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Nieminen Juha wrote:
>
> No, normal distribution is distributed in the form e^(-x^2). You can get
> an approximation by calculating the average of at least three random numbers
> (the more the numbers, the better the approximation, but three is usually
> close enough).
>
Sorry about the confusion. I always have those mixed up for some reason.
Perhaps a gaussian distribution macro would also be useful...
But not necessary, as the average of 3 norm^H^H^H^H linear distribution macros
would do the trick.
Margus
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |