בעיה קלה ב JAVA איך אני יוצר מספר רנדומלי בין שני מספרים - תכנות - HWzone פורומים
עבור לתוכן
  • צור חשבון

בעיה קלה ב JAVA איך אני יוצר מספר רנדומלי בין שני מספרים


GENERAL

Recommended Posts

(Sorry for writing in English, the hebrew alignment makes the following example seem weird)

create a new Random object and use the nextInt(int n) method to generate a pseudo-random int between 0 and the parameter n (n isn't included), for example:

Random rand = new Random();

int some_int = rand.nextInt(5);

some_int will get a random value from one of the follwing: 0,1,2,3,4

hope it helps

Roi

עריכה: נראה כאילו לכתוב באנגלית לא ממש הועיל, ההודעה מיושרת לימין בלאו הכי :s07:

קישור לתוכן
שתף באתרים אחרים

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

×
  • צור חדש...