1 文本格式
using System;
namespace Legalsoft.Truffer
{
/// <summary>
/// Recommended generator for everyday use.The period is 1.8E19. Calling
/// conventions same as Ran, above.
/// </summary>
public class Ranq1
{
private ulong v { get; set; }
public Ranq1(ulong j)
{
this.v = 4101842887655102017L;
v ^= j;
v = (ulong)int64();
}
public ulong int64()
{
v ^= v >> 21;
v ^= v << 35;
v ^= v >> 4;
return (ulong)(v * 2685821657736338717L);
}
/// <summary>
/// Return random double-precision floating value in the range 0. to 1.
/// </summary>
/// <returns></returns>
public double doub()
{
double r= 5.42101086242752217E-20 * int64();
return (r < 0.0) ? (1 + r) : r;
}
public uint int32()
{
return (uint)int64();
}
}
}
2 代码格式
using System;
namespace Legalsoft.Truffer
{
/// <summary>
/// Recommended generator for everyday use.The period is 1.8E19. Calling
/// conventions same as Ran, above.
/// </summary>
public class Ranq1
{
private ulong v { get; set; }
public Ranq1(ulong j)
{
this.v = 4101842887655102017L;
v ^= j;
v = (ulong)int64();
}
public ulong int64()
{
v ^= v >> 21;
v ^= v << 35;
v ^= v >> 4;
return (ulong)(v * 2685821657736338717L);
}
/// <summary>
/// Return random double-precision floating value in the range 0. to 1.
/// </summary>
/// <returns></returns>
public double doub()
{
double r= 5.42101086242752217E-20 * int64();
return (r < 0.0) ? (1 + r) : r;
}
public uint int32()
{
return (uint)int64();
}
}
}