POV-Ray : Newsgroups : povray.pov4.discussion.general : Feature requests: true rand() and date() Server Time
21 Nov 2024 14:47:51 EST (-0500)
  Feature requests: true rand() and date() (Message 1 to 8 of 8)  
From: Timo Poikola
Subject: Feature requests: true rand() and date()
Date: 4 Jan 2009 15:10:01
Message: <web.496116dc7e5264fe3332e10f0@news.povray.org>
First of all, it will be nice if the RNG is able to generate true random
numbers. I will be also happy if there is date() or time() or localtime() or
something mechanism which returns a timestamp.

Thank.


Post a reply to this message

From: Warp
Subject: Re: Feature requests: true rand() and date()
Date: 4 Jan 2009 15:47:53
Message: <49612079@news.povray.org>
Timo Poikola <nomail@nomail> wrote:
> First of all, it will be nice if the RNG is able to generate true random
> numbers.

  Exactly how do you suggest it would do that?

-- 
                                                          - Warp


Post a reply to this message

From: Chris B
Subject: Re: Feature requests: true rand() and date()
Date: 4 Jan 2009 16:26:27
Message: <49612983$1@news.povray.org>
"Timo Poikola" <nomail@nomail> wrote in message 
news:web.496116dc7e5264fe3332e10f0@news.povray.org...
> First of all, it will be nice if the RNG is able to generate true random
> numbers. I will be also happy if there is date() or time() or localtime() 
> or
> something mechanism which returns a timestamp.
>

Generally a repeatable sequence of pseudo-random numbers is far more useful 
in this type of graphics application than a non-repeatable pseudo-random 
number sequence. If you want to further randomised the sequence, for example 
to get a a different pseudo-random number stream in each frame of an 
animation, you can use the frame_number as a seed.

If you want to get access to the time or date you can already use an ini 
file option (e.g. Pre_Scene_Command or Pre_Frame_Command) to shell-out an 
operating system command that writes a date/time stamp to a file in a 
suitable format which you can then #read or #include from within your scene 
file. Then, if you want to get a non-repeatable sequence of pseudo-random 
numbers you could use some function of the time as your pseudo-random number 
seed.

If none of these meets your need it would be helpful if you could explain 
the particular situation where you believe a 'true' random number sequence 
might be of use (if it were possible to implement :-)).

Regards,
Chris B.


Post a reply to this message

From: Nicolas Alvarez
Subject: Re: Feature requests: true rand() and date()
Date: 4 Jan 2009 18:32:05
Message: <496146f4@news.povray.org>
Timo Poikola wrote:
> First of all, it will be nice if the RNG is able to generate true random
> numbers.

Computers can't do that.

> I will be also happy if there is date() or time() or localtime() 
> or something mechanism which returns a timestamp.

MegaPOV supports something like this. I really don't see the purpose :)


Post a reply to this message

From: Warp
Subject: Re: Feature requests: true rand() and date()
Date: 4 Jan 2009 18:58:41
Message: <49614d31@news.povray.org>
Nicolas Alvarez <nic### [at] gmailcom> wrote:
> Timo Poikola wrote:
> > First of all, it will be nice if the RNG is able to generate true random
> > numbers.

> Computers can't do that.

  Actually that's not entirely true. For example see:

http://en.wikipedia.org/wiki//dev/random

  Of course this is extremely system-dependent (and /dev/random might not
be the fastest possible way of generating random numbers).

-- 
                                                          - Warp


Post a reply to this message

From: clipka
Subject: Re: Feature requests: true rand() and date()
Date: 4 Jan 2009 23:55:01
Message: <web.49619190dfc337b2c38b01850@news.povray.org>
"Timo Poikola" <nomail@nomail> wrote:
> First of all, it will be nice if the RNG is able to generate true random
> numbers.

Not possible without some dedicated hardware (atomic decay, thermal noise, ...).
All software can do on its own is something that *looks* more or less random.

Then again, maybe what you actually want is a pseudorandom sequence that is
different every time you run it. For that, using something like...

> I will be also happy if there is date() or time() or localtime() or
> something mechanism which returns a timestamp.

.... as a seed for the RNG would do the job.


Post a reply to this message

From: clipka
Subject: Re: Feature requests: true rand() and date()
Date: 5 Jan 2009 00:15:00
Message: <web.49619630dfc337b2c38b01850@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
> Nicolas Alvarez <nic### [at] gmailcom> wrote:
> > Timo Poikola wrote:
> > > First of all, it will be nice if the RNG is able to generate true random
> > > numbers.
>
> > Computers can't do that.
>
>   Actually that's not entirely true. For example see:
>
> http://en.wikipedia.org/wiki//dev/random

As far as I can see, even these are, technically speaking, not random after all.
They're just a *very* complex PRNG (basically using the whole system for
pseudorandom feedback). I'd expect the generated number sequences to pass all
known tests for randomness though, so in practice it should be way sufficient.
For cryptographic applications that is, because something like POV has totally
different requirements for a (P)RNG.

It happens that I've just recently stumbled across an article in a computer
magazine about RNGs and PRNGs; it actually includes a description of an
interesting DIY hardware RNG, exploiting the thermal noise from a webcam CCD.


Post a reply to this message

From: Warp
Subject: Re: Feature requests: true rand() and date()
Date: 5 Jan 2009 13:01:19
Message: <49624aef@news.povray.org>
clipka <nomail@nomail> wrote:
> > http://en.wikipedia.org/wiki//dev/random

> As far as I can see, even these are, technically speaking, not random after all.
> They're just a *very* complex PRNG (basically using the whole system for
> pseudorandom feedback).

  I'm not sure that it's one property of pseudo-random number generators,
but usually their outcome is completely predictable when you know the values
of all the variables (because the formula of a PRNG is completely
deterministic and not influenced by anything but those values).

  However, unless I'm mistaken, the values gotten from /dev/random are not
predictable, which may well be a definition of a "true" RNG (or at least a
minimum requirement).

-- 
                                                          - Warp


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.