Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 62799
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T18:31:57+00:00 2026-05-10T18:31:57+00:00

Is there a difference between generating multiple numbers using a single random number generator

  • 0

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 implementations generate numbers which are equally random? Is there a difference between the normal RNGs and the secure RNGs for this?

I have a web application that is supposed to generate a list of random numbers on behalf of clients. That is, the numbers should appear to be random from each client’s point of view. Does this mean I need retain a separate random RNG per client session? Or can I share a single RNG across all sessions? Or can I create and discard a RNG on a per-request basis?

UPDATE: This question is related to Is a subset of a random sequence also random?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T18:31:58+00:00Added an answer on May 10, 2026 at 6:31 pm

    A random number generator has a state — that’s actually a necessary feature. The next ‘random’ number is a function of the previous number and the seed/state. The purists call them pseudo-random number generators. The numbers will pass statistical tests for randomness, but aren’t — actually — random.

    The sequence of random values is finite and does repeat.

    Think of a random number generator as shuffling a collection of numbers and then dealing them out in a random order. The seed is used to ‘shuffle’ the numbers. Once the seed is set, the sequence of numbers is fixed and very hard to predict. Some seeds will repeat sooner than others.

    Most generators have period that is long enough that no one will notice it repeating. A 48-bit random number generator will produce several hundred billion random numbers before it repeats — with (AFAIK) any 32-bit seed value.

    A generator will only generate random-like values when you give it a single seed and let it spew values. If you change seeds, then numbers generated with the new seed value may not appear random when compared with values generated by the previous seed — all bets are off when you change seeds. So don’t.

    A sound approach is to have one generator and ‘deal’ the numbers around to your various clients. Don’t mess with creating and discarding generators. Don’t mess with changing seeds.

    Above all, never try to write your own random number generator. The built-in generators in most language libraries are really good. Especially modern ones that use more than 32 bits.

    Some Linux distros have a /dev/random and /dev/urandom device. You can read these once to seed your application’s random number generator. These have more-or-less random values, but they work by ‘gathering noise’ from random system events. Use them sparingly so there are lots of random events between uses.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 63k
  • Answers 63k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer In the last line you're updating the position of the… May 11, 2026 at 10:27 am
  • added an answer First, why aren't you using the Django ORM for this?… May 11, 2026 at 10:27 am
  • added an answer I think you don't do it right. The way I… May 11, 2026 at 10:27 am

Related Questions

Is there a difference between generating multiple numbers using a single random number generator
Is there a difference between NULL and null in PHP? Sometimes they seem to
Is there a difference between just saying throw; and throw ex; assuming ex is
Is there a difference between the two examples below for beginning a Perl script?
Is there a difference between using a makefile and a Makefile?
Is there a difference between SSLv3 and TLSv1? How does IIS6.0 control what type
Is there a difference between GO and BEGIN...END in SQL Scripts/Stored Procedures? More specifically,
Is there a difference between having a private const variable or a private static
Is there a difference between Cursor.Current and this.Cursor (where this is a WinForm) in
Is there a difference between using exit() or just return statements in main() ?

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.