[FFmpeg-user] Question about random() expression
Michael Koch
astroelectronic at t-online.de
Thu Dec 28 10:33:29 EET 2023
Am 28.12.2023 um 03:25 schrieb Carl Zwanzig:
> On 12/27/2023 3:54 PM, Jim DeLaHunt wrote:
>> The documentation says, "x is the index of the internal variable
>> which will be used to save the seed/state."
>> (https://ffmpeg.org/ffmpeg-all.html#Expression-Evaluation). I don't
>> know what it means by "index of the internal variable", and I don't
>> know what "save" means. In a function named random(), I expect the
>> parameter to be used as a seed. I guess this is one of the places
>> where one has to read the source code.
>
> I also suspect that "read the source" is the answer, but also recall
> from decades past that some systems (e.g. BASIC) needed a "randomize"
> statement in order to get off their usual starting point.
I figured out what's going on. It seems the memory of variable 0 is a
union of int and double.
When used by the expressions ld() and st(), it's double.
When used by random(), then it's int.
Important thing to remember:
If you want to set the random generator to a seed value much different
from 0, then you have to use rather big numbers, for example 2^41.
Michael
More information about the ffmpeg-user
mailing list