Henry Wong wrote:Try the java.util.Random class.
Henry
60 % of the time insert an object
(a) 10 % insert an Integer between 12 and 134
(b) 24 % insert a RationalNumber with num 0 to 8 and den 1 to 23
(c) 20 % insert a point with both coordinates between -4.6 and 37.5
(d) 6% insert another copy of the string “hello#” the number increasing each time)
40% of the time delete an object
S Gregg wrote:i know i can calculate 10% of 70 = 7 and insert 7 integers, then calculate 24% of 70 = 17 and insert 17 RationalNumbers, etc but this wouldn't be random
S Gregg wrote:i know i can calculate 10% of 70 = 7 and insert 7 integers, then calculate 24% of 70 = 17 and insert 17 RationalNumbers, etc but this wouldn't be random
S Gregg wrote:I did gather that from what Henry Wong posted earlier and I tried to implement it but one issue I have is, what if several of the numbers generated are in the same group, that will throw the percentages off.
S Gregg wrote: Here is what I have so far
Exactly. Runs of the the same value are always possible. I found myself taking part in a little game with a coin a few weeks ago; I was "heads" every time . . . and won £10 as the last person standinguj nossnahoj wrote: . . . same number many times. Have you ever noticed an ordinary dice behave like that?