Do stateless random number generators exist?

前端 未结 10 2025
孤街浪徒
孤街浪徒 2020-11-29 10:12

Is there a difference between generating multiple numbers using a single random number generator (RNG) versus generating one number per generator and discarding it? Do both

10条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-29 10:44

    Normally seeding a new state takes quite while for a serious PRNG, and making new ones each time won't really help much. The only case I can think of where you might want more than one PRNG is for different systems, say in a casino game you have one generator for shuffling cards and a separate one to generate comments done by the computer control characters, this way REALLY dedicated users can't guess outcomes based on character behaviors.

    A nice solution for seeding is to use this (Random.org) , they supply random numbers generated from the atmospheric noise for free. It could be a better source for seeding than using time.

    Edit: In your case, I would definitely use one PRNG per client, if for no other reason than for good programming standards. Anyways if you share one PRNG among clients, you will still be providing pseudo-random values to each, of a quality equal to your PRNG's quality. So that's a viable option but seems like a bad policy for programming

提交回复
热议问题