-
int last; public void GetRandomDifferentFromLast() { DebugTool.Log("last~~~~~~~~~~" + last); get: int now = Random.Range(0, 3); if (now == last) { goto get; } DebugTool.Log("now~~~~~~~~~~" + now); last = now; DebugTool.Log("==============="); }
-
int last; int now2; public void GetRandomDifferentFromLast2() { DebugTool.Log("last~~~~~~~~~~" + last); do { now2 = Random.Range(0, 3); } while (now2 == last); DebugTool.Log("now2~~~~~~~~~~" + now2); last = now2; DebugTool.Log("==============="); }
随机出与上次不同的随机值
最新推荐文章于 2024-05-28 17:44:06 发布