Mac Developer Library

Developer

ScreenSaver Framework Reference Screen Saver Functions Reference

Options
Deployment Target:

On This Page
Language:

Screen Saver Functions Reference

This chapter describes functions and function-like macros available in the Screen Saver framework.

Several of the functions produce random values. These make use of the C random number generator, random(), which the screen saver framework will automatically seed.

Functions

  • This function returns a random integer value.

    Declaration

    Swift

    func SSRandomIntBetween(_ a: Int32, _ b: Int32) -> Int32

    Objective-C

    int SSRandomIntBetween ( int a, int b );

    Discussion

    Returns a random integer value between the values a and b, inclusive.

    Import Statement

    import ScreenSaver

    Availability

    Available in OS X v10.0 and later.

  • This function returns a random float value.

    Declaration

    Swift

    func SSRandomFloatBetween(_ a: CGFloat, _ b: CGFloat) -> CGFloat

    Objective-C

    CGFloat SSRandomFloatBetween ( CGFloat a, CGFloat b );

    Discussion

    Returns a random float value between the values a and b, inclusive.

    Import Statement

    import ScreenSaver

    Availability

    Available in OS X v10.0 and later.

  • This function returns a random point.

    Declaration

    Swift

    func SSRandomPointForSizeWithinRect(_ size: NSSize, _ rect: NSRect) -> NSPoint

    Objective-C

    NSPoint SSRandomPointForSizeWithinRect ( NSSize size, NSRect rect );

    Discussion

    Returns a random point within rect, constrained within (rect.size - size) from rect’s origin.

    Import Statement

    import ScreenSaver

    Availability

    Available in OS X v10.0 and later.