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

  • Home
  • SEARCH
  • 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 7732509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T06:44:53+00:00 2026-06-01T06:44:53+00:00

I have a large distributed program across many different physical servers, each program spawns

  • 0

I have a large distributed program across many different physical servers, each program spawns many threads, each thread use Math.random() in its operations to draw a piece from many common resource pools.

The goal is to utilize the pools evenly across all operations. Sometimes, it doesn’t appear so random by looking at a snapshot on a resource pool to see which pieces it’s getting at that instant (it might actually be, but it’s hard to measure and find out for sure).

Is there something that’s better than Math.random() and performs just as good (not much worse at least)?

  • 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. Editorial Team
    Editorial Team
    2026-06-01T06:44:54+00:00Added an answer on June 1, 2026 at 6:44 am

    Math.random() is based on java.util.Random, which is based on a linear congruential generator. That means its randomness is not perfect, but good enough for most tasks, and it sounds like it should be sufficient for your task.

    However, it sounds like you’re using the double return value of Math.random() to choose between a fixed number of choices, which may further degrade the quality of the randomness. It would be better to use java.util.Random.nextInt() – just be sure to reuse the same Random object.

    Sometimes, it doesn’t appear so random by looking at a snapshot on a resource pool to see which pieces it’s getting at that instant

    Our brains are really good at spotting patterns in perfect randomness, so that means almost nothing.

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

Sidebar

Related Questions

We have a distributed .net system which consists of several solutions, each with different
I have 1000 large numbers, randomly distributed in range 37231 to 56661. I am
I'm designing a training program in C++ that will be distributed to a large
I have a large set of scalar values distributed over a 3D mesh (one
I am debugging a large application distributed over many units. I ran into a
I have a general question about large in-memory objects and distributed computing. I have
I have an application which will be distributed to a large number of people
We have a large database with enquiries, each enquirys is referenced using a Guid.
I have large images displayed in a grouped tableview. I would like the images
I have large database table, approximately 5GB, now I wan to getCurrentSnapshot of Database

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.