Alice Community Since when does MAX mean LESS THAN?

 Since when does MAX mean LESS THAN?
 RecoJohnson Junior Member   Status: Offline Posts: 9 Join Date: Nov 2011 Location: Canada Since when does MAX mean LESS THAN? - 11-07-2011, 08:45 PM Alice is really frustrating to work with because of simple non-logical elements like this...
 Powerhouse64 Senior Member     Status: Offline Posts: 54 Join Date: Nov 2011 Location: In ur base, movin ur stuffs 11-07-2011, 08:56 PM You sir seem to just be unfortunately unlucky! I just plugged that same program into Alice and got a satisfactory spread of numbers! Alice just didn't pick four for a bit for you apparantly! Hogwarts: Where everything is made up, and the points don't matter
 x2495iiii Super Moderator     Status: Offline Posts: 3,508 Join Date: Dec 2008 Location: Somewhere in the Continental U.S. 11-07-2011, 09:16 PM I've had the same thing happen to me before. I think it was a bug that was fixed in the updates. I don't suppose your copy of Alice is old?
 Mr Kidnapper Senior Member   Status: Offline Posts: 442 Join Date: Feb 2011 11-08-2011, 12:45 AM Less of a bug and more of an off-by-one error. See, when programming people tend to make lots of off-by-one's, especially when concerning inequalities. They're really hard to find because they don't generate an error, and are somewhat hard to find under a massive stack of code. Likely all the guy had to do was change the operator for the max random number from < to <=.
 Random number
 aikmin Senior Member     Status: Offline Posts: 85 Join Date: Mar 2008 Random number - 11-08-2011, 02:59 AM This is not a bug. Random number returns a Double value between 0 and 1 (not including 1). For minimum, Alice simply add the "min value" to the generated number. For maximum, Alice multiply the "max value" with the generated number. Note: This is not something Alice made up. Edit: "integerOnly==true" returns the int of the Double value and not the Round to prevent you from getting 1. random number min=0, max=1, integerOnly=true always return 0 0.12 returns 0 0.55 also returns 0 0.99 also returns 0 By definition of the Random number [ min, max ). Last edited by aikmin; 11-08-2011 at 03:13 AM.
 RecoJohnson Junior Member   Status: Offline Posts: 9 Join Date: Nov 2011 Location: Canada 11-08-2011, 07:14 PM @aikmin So how exactly is a number calculated? I tried what you said : @Mr Kidnapper - Not really a bug but a programming error I agree. But.. doesn't bug == programming error? @x2495iiii I am using Alice 2.2, and I have the latest version of Java installed. @Powerhouse64 can you post a screenshot? I want to see this
 legolizard Senior Member     Status: Offline Posts: 242 Join Date: Jan 2011 Location: Aboard the Hyperion escaping the zerg. 11-08-2011, 09:59 PM This is not a "bug." In most programming languages the start of something is not '1' it is '0' So at the moment disregard the minimum value and assume it is 0. So your maximum is whatever you want say 6. So you can get 0 , 1 , 2 , 3 , 4 , and 5. Now count how many numbers that is. 6 The maximum really specifes how many numbers you can display starting with 0. That is why it is a bit odd. Let's take your first example. Min : 1 Max : 4 However remember that the computer starts with 0 so instead make it : Min : 0 Max : 4 So what you would be able to display 0 , 1 , 2 , 3. Note how we have 4 numbers. But wait we have a problem your output did not show 0. So this is what I think Alice does. It finds the numbers we just found above and then uses the minimum value to determine how many of those it should display. In your case since you specified 1 it would display 4 - 1 or 3 different numbers. Them being 1 , 2 , and 3. Hope that is not too confusing. "Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe."-Albert Einstein

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Announcements     Community News and Announcements Alice 3     How Do I?     Works In Progress     Share Your World     Share Custom Classes     Bugs and Trouble Shooting     Suggestion Box Alice 2     How do I...?     Works-In-Progress     Share Worlds     Share Objects     Bugs and Troubleshooting     Suggestion Box Educators     Teaching with Alice     Teaching Using Alice 3     Teaching Using Alice 2     CS Principles and Alice     AP CSA and Intro to Java and Alice     Workshops General Discussion     Questions and Comments     The Lounge