using RichCreator.Utility.Structs;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
|
namespace RichCreator.Utility
|
{
|
public class RandomUtils
|
{
|
private static Random r = new Random(DateTime.Now.Second);
|
/// <summary>
|
/// 产生随机数
|
/// </summary>
|
/// <param name="min"></param>
|
/// <param name="max"></param>
|
/// <returns></returns>
|
public static Int32 G(Int32 min, Int32 max)
|
{
|
return r.Next(min, max);
|
}
|
|
/// <summary>
|
/// 得到点击时,按下和抬起的间隔
|
/// </summary>
|
public static Int32 MouseClickDuration
|
{
|
get
|
{
|
Int32 r= RandomUtils.G(58, 159);
|
return r;
|
}
|
}
|
|
/// <summary>
|
/// 得到点击时最小时间,按下和抬起的间隔
|
/// </summary>
|
public static Int32 MouseClickDurationMin
|
{
|
get
|
{
|
return 58;
|
}
|
}
|
|
|
|
|
/// <summary>
|
/// 鼠标每次移动距离
|
/// </summary>
|
public static Int32 MouseMoveDistance
|
{
|
get
|
{
|
return G(30, 57);
|
}
|
}
|
|
/// <summary>
|
/// 鼠标每次移动时间
|
/// </summary>
|
public static Int32 MouseMoveDuration
|
{
|
get
|
{
|
return G(10, 15);
|
}
|
}
|
|
/// <summary>
|
/// 按键时,键盘按下和弹起的时间间隔
|
/// </summary>
|
public static Int32 KeyPressDuration
|
{
|
get
|
{
|
return G(KeyPressDurationMin, KeyPressDurationMax);
|
}
|
}
|
|
|
/// <summary>
|
/// 按键时,键盘按下和弹起的时间间隔最小值
|
/// </summary>
|
public const Int32 KeyPressDurationMin = 80;
|
//public const Int32 KeyPressDurationMin = 30;
|
|
/// <summary>
|
/// 按键时,键盘按下和弹起的时间间隔最大值
|
/// </summary>
|
public const Int32 KeyPressDurationMax = 176;
|
//public const Int32 KeyPressDurationMax = 35;
|
|
/// <summary>
|
/// 让点在范围内随机
|
/// </summary>
|
/// <param name="point"></param>
|
/// <param name="range"></param>
|
/// <returns></returns>
|
public static ZTPoint PointRange(ZTPoint point, Int32 range)
|
{
|
return point.Add(G(0, range));
|
}
|
}
|
}
|