COIN-OR::LEMON - Graph Library

Opened 2 years ago

Last modified 3 days ago

#602 new enhancement

Platform independent pseudo random sequences

Reported by: alpar Owned by: alpar
Priority: major Milestone: LEMON 1.4 release
Component: core Version: hg main
Keywords: Cc:
Revision id:


LEMON's random generator is based on the Mersenne Twister algoritm and it is optimized to 32 and 64 bit architecture. This is fine, except when someone want to obtain reproducible results (for a given initial seed) on each platform. The attached patch provides the following solution to this.

The original Random class becomes a template and goes to the _random_bits namespace, then three typedefs are defined:

  • Random is exactly the same as the class Random was before,
  • Random32 is the 32 bit version (on all platform) and
  • Random64 is the 64 bit version (on all platform).

This solution is fully backward compatible and the only drawback I can see is the documentation - one has to visit the template version to see the detailed API.

What do you think, is the documentation is acceptable in this form? If not, what would be a better solution?

Attachments (2)

602-db1d342a1087.patch (39.1 KB) - added by alpar 2 years ago.
602-026829fdb6d4.patch (7.6 KB) - added by kpeter 3 days ago.

Download all attachments as: .zip

Change History (4)

Changed 2 years ago by alpar

comment:1 Changed 18 months ago by alpar

  • Type changed from defect to enhancement

comment:2 Changed 3 days ago by kpeter

I do like this changeset, we should merge it to the main branch.

I also added a patch [026829fdb6d4] with javadoc improvements (it is on the top of the proposed patch).

Last edited 3 days ago by kpeter (previous) (diff)

Changed 3 days ago by kpeter

Note: See TracTickets for help on using tickets.