Alice Community Need help with a program

 Need help with a program
 mawnstah Junior Member   Status: Offline Posts: 3 Join Date: Oct 2011 Need help with a program - 10-21-2011, 11:16 AM Ok, I want to randomly generate 2 numbers then ask the user what is the answer, please help I'm so lost..
DensetsuNoKaboom
Senior Member

Status: Offline
Posts: 1,188
Join Date: May 2010
Location: e4eaf2
10-22-2011, 12:38 PM

Quote:
If you want a number randomly generated, make a number variable and make a method telling it to set itself to a random number; there should be a "random number" function under the world's functions.

Thank you for taking the time to read this signature. This signature loves you.

 Powerhouse64 Senior Member     Status: Offline Posts: 54 Join Date: Nov 2011 Location: In ur base, movin ur stuffs 11-04-2011, 05:38 PM If you use the random number generator, it does generate a random number, but it includes decimal points. If you want to make it a bit easier on the user (I assume they're trying to guess the two numbers, or the product) have the random number be multiplied by 1. This prevents you from getting values such as 1.0 which Alice interprets as different from 1 (this caused some problems with my class, as we tried to tally up the number of randomly generated numbers 1-6 and we got 1.0's represented as a different value). Basically, put in the random number generator into the two places in your function that you need to create within your method, then multiply both random numbers by 1 to get 1-6 as opposed to 1.0-6.0 which Alice considers different numbers. (If Alice generated a 1.0 and the user guessed that the number was 1, Alice would consider them wrong, because of the fact that Alice does not understand that 1.0 and 1 are the same values) Hope my paragraph helps! -Powerhouse64 Hogwarts: Where everything is made up, and the points don't matter

 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