The Daily Click ::. Forums ::. Klik Coding Help ::. How to pick a number random from a pool of numbers [f.e. 2,5,11]
 

Post Reply  Post Oekaki 
 

Posted By Message

Demondevilmon



Registered
  29/12/2014 18:58:20
Points
  152
10th November, 2016 at 10/11/2016 01:18:35 -

Hello friends!
Obviously there are functions like random, random range and stuff.
But those always take a chain of numbers[f.e. 12345] to pick one.

How can i pick random from numbers which are not close one another [f.e. 2,5,11] ?

Thx for ur help!
Greets DD

 
I am not a hero... never was... never will be.

nim



Registered
  17/05/2002
Points
  7234
11th November, 2016 at 11/11/2016 00:26:21 -

Put the numbers in an array or list and get the data of an element chosen by random number.

1: 4
2: 5
3: 10
4: 18
5: 23
6: 28
7: 49

Set counter to Value[element(random(7)]

 
//

Demondevilmon



Registered
  29/12/2014 18:58:20
Points
  152
12th November, 2016 at 12/11/2016 19:52:03 -

U're a genius
Thx very much!

 
I am not a hero... never was... never will be.
   

Post Reply



 



Advertisement

Worth A Click