Opened 11 months ago
Closed 7 months ago
#10763 closed enhancement (fixed)
Improve documentation for random() expression
Reported by: | Michael Koch | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | documentation |
Version: | git-master | Keywords: | seed |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | yes | |
Analyzed by developer: | yes |
Description
Please add this to the documentation of the random() expression:
random(0) uses the variable 0 as a seed value. 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 st(0, 241).
Change History (7)
comment:1 by , 11 months ago
comment:2 by , 10 months ago
After the recent changes in the random() expression, it's no longer required to use huge integer values as seed. I suggest to add this note to the documentation:
The default seed value is 0, because all internal variables are initialized with 0. If you want to use a different seed value, you must set the internal variable to an integer value, for example st(0,99). It doesn't work if you set it to a float value between 0 and 1.
comment:3 by , 10 months ago
This note might also be helpful:
The random generator does always reproduce the same sequence of random numbers.
If you want a different sequence each time FFmpeg is started, you can randomize the generator by using the realtime clock as seed: st(0,1e6*time(0));
The factor 1e6 is required to make sure that multiple threads are initialized with different seed values. This factor can be omitted if the number of threads is limited to 1 with -filter_threads 1.
comment:4 by , 10 months ago
You don't need to constrain the entire filtergraph to the same thread count. Append threads=1
as an option to the filter you wish to limit.
comment:5 by , 10 months ago
Append threads=1 as an option to the filter you wish to limit.
Is this documented? I can't find it.
comment:6 by , 10 months ago
It's a generic filter option, same as enable
for timeline editing. I don't see it documented either.
comment:7 by , 7 months ago
Analyzed by developer: | set |
---|---|
Reproduced by developer: | set |
Resolution: | → fixed |
Status: | new → closed |
Possibly fixed in commit:
https://git.videolan.org/?p=ffmpeg.git;a=commitdiff;h=8ceb37d5ad730b93e4a277b74a5279c5d1f7864a
Please reopen if you have further suggestions with the wording.
Wiki formatting did change the text. I meant this: