I am fairly new to android and java

i tried following code to generate different random numbers in the
ranges of 1 - 9

i wrote following code

                                int i = (int) Math.random() * 9 + 1;
                                while (i == previousIndex) {
                                        i = (int) Math.random() * 9 + 1;
                                }

always i is getting 0 and goes to infinite loop, why so ?

sorry for a novice question though :P

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to