jj logo
Take a quick tour of JJ
Teacher Registration
Student Registration
Industry Registration
Guest Registration
Some Humor
Friends
Quotes


Name
Password
School


..
Class Random

Class MyRandom
 --Name: ??  -- your loginId goes here instead of the ??

 Box value ofType real is private

 Invariant
    Check (getRandom() >= 0.0) and (getRandom() < 1.0) bounce "illegal value in MyRandom ("+RealToStr(getRandom())+")"
 EndInvariant

 Constructor MyRandom(none) is public
    Set value = Random()
 EndConstructor MyRandom

 Routine nextRandom(none) is public
    Set value = Random()
 EndRoutine nextRandom

 Function getRandom(none) ofType real is public
    Box result ofType real
    Set result = value
 EndFunction getRandom

EndClass MyRandom
Return to
    JJ
home page
..