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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:54:20+00:00 2026-05-23T21:54:20+00:00

This is kind of a weird question. I’d like to write a Java function

  • 0

This is kind of a weird question. I’d like to write a Java function that will either return true or false. It will ALWAYS return either true or false for the same computer, even if the program has been purged from the computer and reinstalled (that is, no state is allowed.) It will return the same value no matter where in the program it is called, what time it is, if it’s a Tuesday, etc.

My second requirement is that for all of the computers in the world it there should be anywhere from a 50/50 to a 30/70 split in what the function returns. That is, at least 30% of computers need to generate the less-likely result of the function.

My third requirement (the tricky one) is that what causes the true/false split won’t be obvious to users. So splitting along operating system lines isn’t okay, since that’s obvious.

Any thoughts?

Update: True, “same computer” doesn’t have much meaning since computers are made of changeable parts. It’s fine for the value to change if a piece of hardware is replaced.

  • 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-23T21:54:21+00:00Added an answer on May 23, 2026 at 9:54 pm

    Well, the most simple solution would be to just use the last digit of the mac address to return
    true or false based on if its even or odd.
    This will ensure that on the same machine it always returns the same for a machine and it will return true on half the machines in the world.

    import java.net.*;
    
    
    /**
     *
     * @author nick
     */
    public class HardwareTruthGen {
    
       //Instance Variables 
        static InetAddress addr;
        static NetworkInterface net;
        static byte[] macAddr;
        static boolean hardware;
    
       static {
    
           try{  
            addr = InetAddress.getLocalHost();
            net = NetworkInterface.getByInetAddress(addr);
            macAddr = net.getHardwareAddress();
    
            //If mac address ends in an even number return true otherwise return false 
            if((macAddr[(macAddr.length - 1)] % 2) == 0)
                hardware = true;
            else
                hardware = false;
          }
          catch (Exception ex){
    
          }
        }
    
       public static boolean macTrue(){ return hardware;}
    
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is kind of a weird question and more of an annoyance than technical
Here's a coding problem for those that like this kind of thing. Let's see
This is kind of a weird question so my title is just as weird.
This is kind of a weird question, at least for me, as I don't
Hey guys..this is kind of a weird question but I'm making a webapp in
This may sound like a weird question but is there any where I can
This is kind of a weird question but... If I run this query in
This is kind of weird but I'd like to serve multiple websites on the
This is kind of a strange question, but I will try to explain it
This is kind of a weird problem, but I have to create a search

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.