Users Pricing

forum

home / developersection / forums / how to random.choice equivalent in java for an array?

How to Random.choice Equivalent in Java for an Array?

Pravesh Singh 2737 04 Nov 2014

Here is an example of my random.choice implementation in Python.

available_cards = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 'TeamLeader', 'Rohit', 'Kesharwani', 'Alld']
random_computer_card = random.choice(available_cards)
print random_computer_card

Just wondering what the Java equivalent would be for this piece of code. Obviously, I haven't included the import statement in the sample.


Student


1 Answers