|
GRASS 8 Programmer's Manual 8.6.0dev(2026)-51551cd856
|
GIS Library - Random number seed from the option of a tool. More...

Go to the source code of this file.
Functions | |
| int64_t | G_random_seed_from_option (const struct Option *seed) |
| Read the random number seed from a seed option. | |
GIS Library - Random number seed from the option of a tool.
SPDX-FileCopyrightText: 2026 GRASS Development Team SPDX-License-Identifier: GPL-2.0-or-later
Definition in file random_options.c.
Read the random number seed from a seed option.
Call after G_parser() with an option which has an answer. The answer is read with G_random_parse_seed(); an answer which is not a seed is a fatal error naming the option. The parser itself checks an integer option only loosely, so this check is needed.
The result is a seed accepted by G_random_state_from_seed(), the layout functions and G_srand48(). The function does nothing beyond parsing and checking: recording the seed, or generating one when the option is not given, is up to the tool.
| seed | the seed option, usually G_OPT_M_SEED, whatever its key |
Definition at line 32 of file random_options.c.
References _, G_fatal_error(), and G_random_parse_seed().