C prandom_seed_状态的功能是什么?

C prandom_seed_状态的功能是什么?,c,linux,linux-kernel,C,Linux,Linux Kernel,此FUNC位于linux-4.16.12\include\linux\random.h中 static inline u32 __seed(u32 x, u32 m) { return (x < m) ? x + m : x; } static inline void prandom_seed_state(struct rnd_state *state, u64 seed) { u32 i = (seed >> 32) ^ (seed << 10)

此FUNC位于linux-4.16.12\include\linux\random.h中

static inline u32 __seed(u32 x, u32 m)
{
    return (x < m) ? x + m : x;
}

static inline void prandom_seed_state(struct rnd_state *state, u64 seed)
{
    u32 i = (seed >> 32) ^ (seed << 10) ^ seed;

    state->s1 = __seed(i,   2U);
    state->s2 = __seed(i,   8U);
    state->s3 = __seed(i,  16U);
    state->s4 = __seed(i, 128U);
}
静态内联u32\uu种子(u32 x,u32 m)
{
返回(x>32)^(种子s1=u种子(i,2U);
状态->s2=种子(i,8U);
状态->s3=种子(i,16U);
状态->s4=uuu种子(i,128U);
}

它类似于一个随机函数,但我不确定。

该函数通过将64位种子值重新组合为32位值,从64位种子值生成一个四元素状态向量。状态向量中的所有四个元素都设置为相同的值,但所用的算法要求状态向量的元素不具有太多的前导零

此要求在
lib/random32.c
中的
prandom_u32()
实现代码中进行了解释

prandom\u seed\u state()