+ 2

Random array item in java(sorry for bad english)

Hello everybody, I have written a programm together with my friends, but there is another feature we want to add... There is an list in our programm and the user can pick a random element with a command. Is there an option to do this??

6th Feb 2018, 1:29 PM
BanJu TV
BanJu TV - avatar
3 odpowiedzi
+ 16
take random number as index ... from 0 to (no. of elements-1) & use it to get random element using that index
6th Feb 2018, 2:05 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 3
yes you can, just add some HTML codes into it, like adding buttons for users to pick an element
6th Feb 2018, 1:31 PM
Professor Dickster
Professor Dickster - avatar