Skip to content

Inconsistent handling of default seed in NormalGenerator & UniformGenerator  #2985

@SunBlack

Description

@SunBlack

As already discussed here default seed in random.h is not handled consistently.

struct Parameters
{
Parameters (T _mean = 0, T _sigma = 1, pcl::uint32_t _seed = 1)
: mean (_mean)
, sigma (_sigma)
, seed (_seed)
{}
T mean;
T sigma;
pcl::uint32_t seed;
};
/** Constructor
* \param[in] mean normal mean
* \param[in] sigma normal variation
* \param[in] seed seeding value
*/
NormalGenerator(T mean = 0, T sigma = 1, pcl::uint32_t seed = -1);
/** Constructor
* \param parameters normal distribution parameters and seed
*/
NormalGenerator(const Parameters& parameters);

One constructor of NormalGenerator has as default seed -1 during the other one (via Parameters) has 1 as default seed.

Furthermore you get currently following warning:

common/include/pcl/common/impl/random.hpp:49:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if(parameters_.seed != -1)

So we should discuss how to adjust code there.

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort: lowRough estimate of time needed to fix/implement/solvegood first issueSkills/areas of expertise needed to tackle the issuekind: todoType of issueneeds: feedbackSpecify why not closed/merged yet

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions