the thing I wanted to know is that. Example: I want range of number from 1 to 10. and how to call a random number between the range from 1 to 10 automatically. Not using switches cases or if else statements. Any Idea ?
Asked
Active
Viewed 60 times
0
-
Do you know how hava UUID looks like? – Andrei T May 29 '16 at 11:18
-
ahh.. 128 bit value. Example: 48baf78c-3263-42eb-856d-618dd636aa46 – Bibesh Manandhar May 29 '16 at 11:19
-
That being said, why do you need to have it between fixed range? – Andrei T May 29 '16 at 11:26
-
Sir, Is there anything that could be used that could have fixed range and when we call it, it should return random numbers between that fixed range. – Bibesh Manandhar May 29 '16 at 11:28
-
As far as I know no, you might need to implement your own generator. Check the grep code: http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/util/UUID.java#UUID.randomUUID%28%29 – Andrei T May 29 '16 at 11:32
-
Is there any other class or method except UUID ? Can I use Random ? – Bibesh Manandhar May 29 '16 at 11:33
-
So, what do you want to achieve? Be clear on that, you first said you want UUID between some ranges, now you are asking me about random. Write clearly the use-case, otherwise me or someone will mark it as not-clear question – Andrei T May 29 '16 at 11:39
-
Sorry sir. Okay, the thing I wanted to know is that. Example: I want range of number from 1 to 10. and how to call a random number between the range from 1 to 10 automatically. Not using switches cases or if else statements. Any Idea ? – Bibesh Manandhar May 29 '16 at 11:42
-
Edit your question accordingly please. – Andrei T May 29 '16 at 11:43
-
@BibeshManandhar If you want to know how to get a random value between two values: [Generating random integers in a specific range](http://stackoverflow.com/questions/363681/generating-random-integers-in-a-specific-range) – pzaenger May 29 '16 at 11:55