Traveller/scripts/utils/HashCodeUtils.cs
Cold-Mint 544c5303f3
Fixed an issue where the return path of the room template set was invalid, the initial room placement was extracted separately from the new method and added to the seed of map generation.
修复房间模板集返回路径无效的问题,初始房间的放置被单独提取出新的方法,加入地图生成时的种子。
2024-05-21 22:50:33 +08:00

23 lines
618 B
C#

using System.Linq;
namespace ColdMint.scripts.utils;
public class HashCodeUtils
{
/// <summary>
/// <para>Gets the hash code for a string</para>
/// <para>获取字符串的哈希码</para>
/// </summary>
/// <param name="str">
///<para>The input string returns a fixed hash code</para>
///<para>输入的字符串,返回固定的哈希码</para>
/// </param>
/// <returns></returns>
public static uint GetFixedHashCode(string str)
{
unchecked
{
return str.Aggregate(2166136261, (current, c) => (current ^ c) * 16777619);
}
}
}