Um, what is previousIndex?

----------------------------------------------------------------------
There are only 10 types of people in the world...
Those who know binary and those who don't.
----------------------------------------------------------------------


On Wed, Nov 18, 2009 at 9:00 AM, Jags <[email protected]> wrote:

> 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]<android-beginners%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-beginners?hl=en

-- 
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