[Android] AudioService: use nextInt

Edward Wang git at videolan.org
Wed Jul 16 19:42:59 CEST 2014


vlc-ports/android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Wed Jul 16 13:42:18 2014 -0400| [877200d245c8db190c23c55ef692530397776caf] | committer: Edward Wang

AudioService: use nextInt

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=877200d245c8db190c23c55ef692530397776caf
---

 vlc-android/src/org/videolan/vlc/audio/AudioService.java |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/audio/AudioService.java b/vlc-android/src/org/videolan/vlc/audio/AudioService.java
index cc7ac4d..38692d1 100644
--- a/vlc-android/src/org/videolan/vlc/audio/AudioService.java
+++ b/vlc-android/src/org/videolan/vlc/audio/AudioService.java
@@ -35,6 +35,7 @@ import java.util.Calendar;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Locale;
+import java.util.Random;
 import java.util.Stack;
 
 import org.videolan.libvlc.EventHandler;
@@ -830,7 +831,7 @@ public class AudioService extends Service {
                     // Find a new index not in mPrevious.
                     do
                     {
-                        mNextIndex = (int)(Math.random() * size);
+                        mNextIndex = new Random().nextInt(size);
                     }
                     while(mNextIndex == mCurrentIndex || mPrevious.contains(mNextIndex));
 



More information about the Android mailing list