I used this android code that when a user touch a screen, vibration is started and continued for 3000 ms. I don't want that always that user touch the screen, the duration of the vibration become the same as previous times(3000 ms). I want to use random that each time the vibration lasts for a random amount of time. How should I use random according to my code?
Please help me.
public boolean dispatchTouchEvent(MotionEvent ev)
{
if (ev.getAction() == MotionEvent.ACTION_UP)
{
Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
v.vibrate(3000);
}
return super.dispatchTouchEvent(ev);
}