1 文本格式
using System;
namespace Legalsoft.Truffer
{
/// <summary>
/// 指数偏差
/// Structure for exponential deviates.
/// </summary>
public class Expondev : Ran
{
private double beta { get; set; }
/// <summary>
/// Constructor arguments are beta and a random sequence seed.
/// </summary>
/// <param name="bbeta"></param>
/// <param name="i"></param>
public Expondev(double bbeta, ulong i) : base(i)
{
this.beta = bbeta;
}
/// <summary>
/// Return an exponential deviate.
/// </summary>
/// <returns></returns>
public double dev()
{
double u;
do
{
u = doub();
} while (Math.Abs(u) <= float.Epsilon);// (u == 0.0);
return -Math.Log(u) / beta;
}
}
}
2 代码格式
using System;
namespace Legalsoft.Truffer
{
/// <summary>
/// 指数偏差
/// Structure for exponential deviates.
/// </summary>
public class Expondev : Ran
{
private double beta { get; set; }
/// <summary>
/// Constructor arguments are beta and a random sequence seed.
/// </summary>
/// <param name="bbeta"></param>
/// <param name="i"></param>
public Expondev(double bbeta, ulong i) : base(i)
{
this.beta = bbeta;
}
/// <summary>
/// Return an exponential deviate.
/// </summary>
/// <returns></returns>
public double dev()
{
double u;
do
{
u = doub();
} while (Math.Abs(u) <= float.Epsilon);// (u == 0.0);
return -Math.Log(u) / beta;
}
}
}