First random number after setSeed in Java always similar

后端 未结 3 889
无人共我
无人共我 2020-12-29 19:05

To give some context, I have been writing a basic Perlin noise implementation in Java, and when it came to implementing seeding, I had encountered a bug that I couldn\'t exp

3条回答
  •  Happy的楠姐
    2020-12-29 19:56

    This is known issue. Similar seed will generate similar few first values. Random wasn't really designed to be used this way. You are supposed to create instance with a good seed and then generate moderately sized sequence of "random" numbers.

    Your current solution is ok - as long as it looks good and is fast enough. You can also consider using hashing/mixing functions which were designed to solve your problem (and then, optionally, using the output as seed). For example see: Parametric Random Function For 2D Noise Generation

提交回复
热议问题