|
| 29 Aug 2013 06:57 PM |
| I'm kind of new to Java and coding in general. But I was wondering how you'd get one member of a table at random. |
|
|
| Report Abuse |
|
|
|
| 29 Aug 2013 06:59 PM |
| Java and javascript are two completely different things. |
|
|
| Report Abuse |
|
|
|
| 29 Aug 2013 07:00 PM |
| Ah. Thank you for the correction. |
|
|
| Report Abuse |
|
|
|
| 29 Aug 2013 07:01 PM |
| What one do you want help with........................ |
|
|
| Report Abuse |
|
|
|
| 29 Aug 2013 07:07 PM |
Well I know how to do it in Java ........
import java.util.Random; int Array[] = {1,2,3,4,5}; int Index = (new Random()).nextInt(Array.length); int Value = Array[Index]; |
|
|
| Report Abuse |
|
|
|
| 29 Aug 2013 07:17 PM |
Javascript doe.
var taybull = [1,2,3]; console.log(taybull[Math.floor(Math.random()*taybull.length)]); |
|
|
| Report Abuse |
|
|