This project is read-only.

1. Prerequisities

1.1 Solving dependencies

The library uses RandomOps library for generating random numbers. Source-code of RandomOps library is published under the GNU Lesser General Public License and can be found here.
As the first step it is necessary to download source-code of RandomOps and compile it to the dll file. How-to-do instructions are part of zip archive containing source-code.

1.2 Creating RandomOps wrapper for F#

  • Create new C# Class Library project in Microsoft Visual Studio
  • Add reference to compiled RandomOps.dll file
  • Create Global Object of RandomOps in accordance with manual of RandomOps library. Manual is available here.
namespace Rnd
{
    public static partial class Globals
    {
        public static RandomOps.Ran2 Random = new RandomOps.Ran2();
    }
  • Because F# cannot operate with partial classes it is necessary to write following class.
namespace Rnd
{
    public static partial class Globals
    {
        public static RandomOps.Ran2 Random = new RandomOps.Ran2();
    }

    public static class RandomNumber
    {
        public static double GetRandom(double min, double max)
        {
            return Globals.Random.Uniform(min, max);
        }
    }
}
  • The wrapper library can be now compiled.

Last edited Aug 26, 2011 at 10:31 AM by lko, version 3

Comments

No comments yet.