This discussion is archived
1 2 3 Previous Next 32 Replies Latest reply: Mar 28, 2013 4:42 PM by EJP Go to original post RSS
  • 15. Re: Do not use java built in Random Function to generate random number.
    gimbal2 Guru
    Currently Being Moderated
    Kayaman wrote:
    EJP wrote:
    My answer would have been "it's in Knuth Volume I" (or II or III as appropriate).
    Coupled with an icy stare at the interviewer, no doubt.
    Imagine having to take a job interview with EJP as the interviewer. People have gone to work for Burger King after that, I'm sure.
  • 16. Re: Do not use java built in Random Function to generate random number.
    EJP Guru
    Currently Being Moderated
    Icy stares don't get you the gig :-|
  • 17. Re: Do not use java built in Random Function to generate random number.
    gimbal2 Guru
    Currently Being Moderated
    EJP wrote:
    Icy stares don't get you the gig :-|
    Depends on the interviewer, perhaps he/she likes your intensity :)
  • 18. Re: Do not use java built in Random Function to generate random number.
    EJP Guru
    Currently Being Moderated
    Actually the last interview I was in I was accused subsequently of being too relaxed.
  • 19. Re: Do not use java built in Random Function to generate random number.
    jwenting Journeyer
    Currently Being Moderated
    EJP wrote:
    Actually the last interview I was in I was accused subsequently of being too relaxed.
    yes, have heard that. "you're so relaxed, you probably don't really want the job or you'd be more tense, so we've decided to go with someone else".

    At least more original than "we don't think you'll fit in our young and dynamic team" proclaimed by the 25 year old HR flunky still wet from showering after he came in on his racing bicycle.
  • 20. Re: Do not use java built in Random Function to generate random number.
    EJP Guru
    Currently Being Moderated
    Had that too. But the 25-year-old flunky couldn't stay long because he had to rush down to the other end of the room to play the electronic drums. Very badly. After 5pm you could do that, play pinball, or a pseudo-electric guitar, also very badly. 100% offensive to a real musician, and a great way to empty the joint of workers at 4:59pm. Assuming that's the objective, which it wasn't.
  • 21. Re: Do not use java built in Random Function to generate random number.
    706710 Newbie
    Currently Being Moderated
    Deepak Lalchandani wrote:
    Language Core Java 1.5 (do not use Random function of java)

    Write a methodA that returns a random number between 0 to 3, Use the same methodA to return a random number between 0 and 7. (do not use Random function) .This is a question which comes under uniform distribution principle.

    Assume i write a methodA and i have to dynamically pass either 0 or 1 or 2 or 3 to the same methodA,this methodA should display a number between 0 to 7

    Rand3(int input) should return dynamically either 0 or 1 or 2 or 3
    The same Rand3(int input) should then return any value between 0 to 7.

    Language is Core Java 1.5
    Solution in Core Java Needed
    Step1:   
    Rand3(int input){   
    //how do i return either 0,1,2,3 dynamically to Rand3() function   
    }   
    
    Step2:pass either 0,1,2,3 to same Rand3 function   
    Rand3(either 0,1,2,3)   
    // generate a number between 0 and 7   
    }  
    IT IS VERY EASY TO MAKE FUN OF SOME ONE ON THE FORUM,PEOPLE LIKE YOU DONT DESERVE TO BE HELPING OTHER PEOPLE ON THE FORUM,
    IF YOU THINK YOU ARE SMART,WHY DONT PROVIDE A COMPLETE WORKING EXAMPLE.
    i'M WONDERING WHY ORACLE HAS SUCH STUPID JAVA SPECIALISTS IN FORUM DOING NOTHING AND SPOLING AND MAKING FUN OF OTHERS.
  • 22. Re: Do not use java built in Random Function to generate random number.
    PhHein Guru Moderator
    Currently Being Moderated
    Deepak Lalchandani wrote:
    Deepak Lalchandani wrote:
    Language Core Java 1.5 (do not use Random function of java)

    Write a methodA that returns a random number between 0 to 3, Use the same methodA to return a random number between 0 and 7. (do not use Random function) .This is a question which comes under uniform distribution principle.

    Assume i write a methodA and i have to dynamically pass either 0 or 1 or 2 or 3 to the same methodA,this methodA should display a number between 0 to 7

    Rand3(int input) should return dynamically either 0 or 1 or 2 or 3
    The same Rand3(int input) should then return any value between 0 to 7.

    Language is Core Java 1.5
    Solution in Core Java Needed
    Step1:   
    Rand3(int input){   
    //how do i return either 0,1,2,3 dynamically to Rand3() function   
    }   
    
    Step2:pass either 0,1,2,3 to same Rand3 function   
    Rand3(either 0,1,2,3)   
    // generate a number between 0 and 7   
    }  
    IT IS VERY EASY TO MAKE FUN OF SOME ONE ON THE FORUM,PEOPLE LIKE YOU DONT DESERVE TO BE HELPING OTHER PEOPLE ON THE FORUM,
    IF YOU THINK YOU ARE SMART,WHY DONT PROVIDE A COMPLETE WORKING EXAMPLE.
    i'M WONDERING WHY ORACLE HAS SUCH STUPID JAVA SPECIALISTS IN FORUM DOING NOTHING AND SPOLING AND MAKING FUN OF OTHERS.
    Posting that reply to yourself says quite a lot.
    You were given quite a few pointers in the discussion so far, but you've never posted your solution.
    Nobody will provide complete working examples here as this is not a code mill, but a forum. As posted before, show your best attempt and ask specific questions.
  • 23. Re: Do not use java built in Random Function to generate random number.
    EJP Guru
    Currently Being Moderated
    IT IS VERY EASY TO MAKE FUN OF SOME ONE ON THE FORUM,
    No doubt, but I don't see that that has happened in this thread. What exactly are you talking about?
    PEOPLE LIKE YOU
    People like who? You're replying to yourself here. Do you mean that people like you shouldn't be helping other people on the forum? You may be right, but there's no evidence here that you're even trying to do that. It's hard to be sure what you're actually talking about when the only available evidence says you are only criticizing yourself.
    DONT DESERVE TO BE HELPING OTHER PEOPLE ON THE FORUM
    What exactly is it that makes you think you're the authority on who deserves to be helping whom? What's your decision criterion? Personally I would much rather have some assistance from a 42-year curmudgeonly veteran who knew what he was talking about than any polite but ignorant junior. You will find both on these forums. The choice of which to read and take notice of is yours, but the decision as to who 'deserves' to post here isn't. And of course as the person who asked the question and doesn't know the answer, you are by definition the last person to decide.
    IF YOU THINK YOU ARE SMART,WHY DONT PROVIDE A COMPLETE WORKING EXAMPLE.
    That's a classic example of argumentum ad hominem, and also argumentum e silentio, but, again, who exactly are you talking about? And you should have observed here already that the last thing you will get here is complete working code. This is not a free coding service.
    I'M WONDERING WHY ORACLE HAS SUCH STUPID JAVA SPECIALISTS IN FORUM DOING NOTHING AND SPOLING AND MAKING FUN OF OTHERS.
    I'm wondering why you even think so. There are very few Oracle employees on these forums, and as far as I'm aware none of them has contributed to this thread. And again I don't see anybody making fun of anybody else. Personally I'm enjoying the thread: I'm finding it quite entertaining.

    You seem to be under several misapprehensions. (1) This is a user-to-user forum. People here are just Java users like yourself: some more experienced; some less so. (2) There is no mechanism by which you can control what is posted in response to your question. The forums are moderated but nothing here has attracted the moderators' attention, except possibly your own mildy abusive outburst. (3) Abusing people who take paid time out of their working day to try to help you isn't exactly a rational procedure.
  • 24. Re: Do not use java built in Random Function to generate random number.
    gimbal2 Guru
    Currently Being Moderated
    You're too relaxed, you apparently don't want the job of forum-question-answerer so we've decided to go with people who scream random and unfounded outrage in all bold caps.

    Too bad, probably this thread will be locked soon now. I know it was quite off-topic, but who cares!
  • 25. Re: Do not use java built in Random Function to generate random number.
    PhHein Guru Moderator
    Currently Being Moderated
    gimbal2 wrote:
    Too bad, probably this thread will be locked soon now. I know it was quite off-topic, but who cares!
    Don't report it and it might survive.
  • 26. Re: Do not use java built in Random Function to generate random number.
    gimbal2 Guru
    Currently Being Moderated
    PhHein wrote:
    gimbal2 wrote:
    Too bad, probably this thread will be locked soon now. I know it was quite off-topic, but who cares!
    Don't report it and it might survive.
    Its not enough, we have to chain up Rubkat.
  • 27. Re: Do not use java built in Random Function to generate random number.
    PhHein Guru Moderator
    Currently Being Moderated
    gimbal2 wrote:
    PhHein wrote:
    gimbal2 wrote:
    Too bad, probably this thread will be locked soon now. I know it was quite off-topic, but who cares!
    Don't report it and it might survive.
    Its not enough, we have to chain up Rubkat.
    Argrhh, now you've messed it up. He's got a listener for people misspelling rukbat.
  • 28. Re: Do not use java built in Random Function to generate random number.
    gimbal2 Guru
    Currently Being Moderated
    PhHein wrote:
    gimbal2 wrote:
    PhHein wrote:
    gimbal2 wrote:
    Too bad, probably this thread will be locked soon now. I know it was quite off-topic, but who cares!
    Don't report it and it might survive.
    Its not enough, we have to chain up Rubkat.
    Argrhh, now you've messed it up. He's got a listener for people misspelling rukbat.
    Holy hell, you're not kidding. I've been doing that for as long as he was created and turned on!
  • 29. Re: Do not use java built in Random Function to generate random number.
    EJP Guru
    Currently Being Moderated
    You're too relaxed, you apparently don't want the job of forum-question-answerer so we've decided to go with people who scream random and unfounded outrage in all bold caps.
    I guess deep down I always knew it wouldn't really last. But you just kid yourself along, from day to day, then one day you wake up, and you think to yourself, "it's come to this".

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points