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 565555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:53:04+00:00 2026-05-13T12:53:04+00:00

Could someone please suggest a good way of taking a global seed value e.g.

  • 0

Could someone please suggest a good way of taking a global seed value e.g. “Hello World” and using that value to lookup values in arrays or tables.

I’m sort of thinking like that classic spacefaring game of “Elite” where there were different attributes for the planets but they were not random, simply derived from the seed value for the universe.

I was thinking MD5 on the input value and then using bytes from the hash, casting them to integers and mod them into acceptable indexes for lookup tables, but i suspect there must be a better way? I read something about Mersenne twisters but maybe that would be overkill.

I’m hoping for something which will give a good distrubution over the values in my lookup tables. e.g. Red, Orange, Yellow, Green, Blue, Purple

Also to emphasize I’m not looking for random values but consistent values each time.

Update: Perhaps I’m having difficulty in expressing my own problem domain. Here is an example of a site which uses generators and can generate X number of values: http://www.seventhsanctum.com

Additional criteria

I would prefer to work from first principles rather than making use of library functions such as System.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. Editorial Team
    Editorial Team
    2026-05-13T12:53:05+00:00Added an answer on May 13, 2026 at 12:53 pm

    My approach would be to use your key as a seed for a random number generator

    public StarSystem(long systemSeed){
        java.util.Random r = new Random(systemSeed);
        Color c = colorArray[r.nextInt(colorArray.length)]; // generates a psudo-random-number based from your seed
        PoliticalSystem politics = politicsArray[r.nextInt(politicsArray.length)];
        ...
    }
    

    For a given seed this will produce the same color and the same political system every time.

    For getting the starting seed from a string you could just use MD5Sum and grab the first/last 64bits for your long, the other approach would be to just use a numeric for each plant. Elite also generated the names for each system using its pseudo-random-generator.

    for(long seed=1; seed<NUMBER_OF_SYSTEMS; seed++){
        starSystems.add(new StarSystem(seed));
    }
    

    By setting the seed to a known value each time the Random will return the same sequence every time it is called, this is why when trying for good random values a good seed is very important. However in your case a known seed will produce the results your looking for.

    The c# equivalent is

    public StarSystem(int systemSeed){
        System.Random r = new Random(systemSeed);
        Color c = colorArray[r.next(colorArray.length)]; // generates a psudo-random-number based from your seed
        PoliticalSystem politics = politicsArray[r.next(politicsArray.length)];
        ...
    } 
    

    Notice a difference? no, nor did I.

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

Sidebar

Related Questions

Can someone help suggest a good way to achieve the following please? I want
Could someone please suggest why this is happening... I’ve got some code to pretty
Could someone please tell me what the CodeURI value of a line break is?
Could someone please suggest a tool to create a Domain Model diagram? Some details:
Could someone please suggest where I might be going wrong with the following code?
Could someone suggest a good library for vector graphics? Several libraries support drawing shapes,
Could someone please show me a minimal working example of using C language for
Could someone please tell me why this <%= destroy_password_url @user.password_reset_token %> generates http://localhost:3000/api/destroy_password.4G5EoRVYMUAtiIKqOerKsw routes.rb
Could someone please explain why this is happening? var y = new int[]{1,2}; Console.WriteLine(y
could someone please tell me what I need to do in order to create

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.