java - A function that generates a boolean that differs between computers, but not within the same computer. Possible? -


this kind of weird question. i'd write java function either return true or false. return either true or false same computer, if program has been purged computer , reinstalled (that is, no state allowed.) return same value no matter in program called, time is, if it's tuesday, etc.

my second requirement of computers in world there should anywhere 50/50 30/70 split in function returns. is, @ least 30% of computers need generate less-likely result of function.

my third requirement (the tricky one) causes true/false split won't obvious users. splitting along operating system lines isn't okay, since that's obvious.

any thoughts?

update: true, "same computer" doesn't have meaning since computers made of changeable parts. it's fine value change if piece of hardware replaced.

well, simple solution use last digit of mac address return true or false based on if or odd. ensure on same machine returns same machine , return true on half machines in 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 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;}   } 

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -