1 文本格式
using System;
namespace Legalsoft.Truffer
{
/// <summary>
/// Structure for logistic deviates.
/// </summary>
public class Logisticdev : Ran
{
private double mu { get; set; }
private double sig { get; set; }
/// <summary>
/// Constructor arguments are mu and sig random sequence seed.
/// </summary>
/// <param name="mmu"></param>
/// <param name="ssig"></param>
/// <param name="i"></param>
public Logisticdev(double mmu, double ssig, ulong i) : base(i)
{
this.mu = mmu;
this.sig = ssig;
}
public double dev()
{
double u;
do
{
u = doub();
} while (Math.Abs(u * (1.0 - u)) <= float.Epsilon);// (u * (1.0 - u) == 0.0);
return mu + 0.551328895421792050 * sig * Math.Log(u / (1.0 - u));
}
}
}
2 代码格式
using System;
namespace Legalsoft.Truffer
{
/// <summary>
/// Structure for logistic deviates.
/// </summary>
public class Logisticdev : Ran
{
private double mu { get; set; }
private double sig { get; set; }
/// <summary>
/// Constructor arguments are mu and sig random sequence seed.
/// </summary>
/// <param name="mmu"></param>
/// <param name="ssig"></param>
/// <param name="i"></param>
public Logisticdev(double mmu, double ssig, ulong i) : base(i)
{
this.mu = mmu;
this.sig = ssig;
}
public double dev()
{
double u;
do
{
u = doub();
} while (Math.Abs(u * (1.0 - u)) <= float.Epsilon);// (u * (1.0 - u) == 0.0);
return mu + 0.551328895421792050 * sig * Math.Log(u / (1.0 - u));
}
}
}