Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Randgen inherit stl random generator #12

Merged
merged 3 commits into from
Jul 31, 2015
Merged

Randgen inherit stl random generator #12

merged 3 commits into from
Jul 31, 2015

Conversation

ngeiswei
Copy link
Member

Since the random generator fully relies on STL I decided to have RandGen directly inherits std::mt19937. That way one can use the generator returned by the singleton randGen() in STL distributions.

I would have preferred to have MT19937RandGen inherit std::mt19937 rather than randGen() but I couldn't because RandGen is the abstract generator class used all over in OpenCog, and as far as I can tell there is no abstract STL generator one could use for that.

The next step would be to get rid of RandGen and MT19937RandGen, only keep rangGen() that would return an std::mt19937 generator (or any STL generator), but that involves changing the all callers. Maybe that's not worth it. The most important is that we can now use STL distributions.

This is kind of a hack because there is no point having that abstract
class inherit a concrete random generator. But it's clear we don't
need that home made random generator structure anymore so it's a step
toward getting rid of it.

The advantage is that the random generator returned by the singleton
randGen() can be now used in the STL distributions.
linas added a commit that referenced this pull request Jul 31, 2015
…ator

Randgen inherit stl random generator
@linas linas merged commit 6192e54 into opencog:master Jul 31, 2015
@ngeiswei ngeiswei deleted the randgen-inherit-stl-random-generator branch August 31, 2015 07:28
ngeiswei added a commit to ngeiswei/cogutil that referenced this pull request Oct 5, 2018
…workflow

Add as-moses to circleci workflow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants