Can I add random viewport colours in 2.79 like in 2.8?
The following add-on randomizes the viewport color. It works for both Cycles and Blender Internal. Save the file into 2.79\scripts\addons and activate if through the preferences. The add-on creates panel in the 3D View properties (N) titled Randomize Viewport Color.




In order for the viewport material to be applied for Cycles you need to have a material applied that uses nodes. This is a safety feature, because otherwise changing the viewport color would also change the material color. A limitation for Cycles in 2.79b is that the viewport color is tied to the material. Every object with the same material will have the same color.

Please keep in mind that this is a quickly written add-on and may have some areas that could be improved. 

bl_info = {
    "name": "Randomize Viewport Colors",
    "author": "Robert Guetzkow",
    "version": (1, 0),
    "blender": (2, 79, 0),
    "location": "View3D &gt; Properties",
    "description": "Randomizes the viewport colors of all objects",
    "warning": "",
    "wiki_url": "",
    "category": "3D View",
}

import bpy
import random


class RandomColorSettings(bpy.types.PropertyGroup):
    use_viewport_color = bpy.props.BoolProperty(
        name="Enable Viewport Color",
        description="When checked and update is pressed the viewport coloring will be enabled for all materials.",
        default=True)


class RANDOMIZE_VIEWPORT_COLORS_OT_update(bpy.types.Operator):
    bl_idname = "randomize_viewport_colors.update"
    bl_label = "Update"
    bl_options = {'REGISTER', 'UNDO'}

    def execute(self, context):
        if context.scene.render.engine == "CYCLES":
            for mat in bpy.data.materials:
                # Make sure that nodes are used, otherwise this will change the actual material color
                if mat.use_nodes:
                    if context.scene.use_viewport_color:
                        mat.diffuse_color = (random.uniform(0.0, 1.0),
                                             random.uniform(0.0, 1.0),
                                             random.uniform(0.0, 1.0))
                    else:
                        mat.diffuse_color = (1.0, 1.0, 1.0)
        else:
            for obj in bpy.data.objects:
                obj.color = (random.uniform(0.0, 1.0), random.uniform(0.0, 1.0), random.uniform(0.0, 1.0), 1.0)

            for mat in bpy.data.materials:
                mat.use_object_color = context.scene.use_viewport_color

        return {'FINISHED'}


class VIEW3D_PT_randomize_viewport_colors(bpy.types.Panel):
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'UI'
    bl_label = "Randomize Viewport Colors"

    def draw(self, context):
        layout = self.layout
        layout.prop(context.scene, "use_viewport_color")
        layout.operator("randomize_viewport_colors.update")


classes = (
    RANDOMIZE_VIEWPORT_COLORS_OT_update,
    VIEW3D_PT_randomize_viewport_colors
)


def register():
    for cls in classes:
        bpy.utils.register_class(cls)
    bpy.types.Scene.use_viewport_color = bpy.props.BoolProperty(
        name="Enable Viewport Color",
        description="When checked and update is pressed the viewport coloring will be enabled for all materials.",
        default=True)

def unregister():
    for cls in classes:
        bpy.utils.unregister_class(cls)
    del bpy.types.Scene.use_viewport_color


if __name__ == "__main__":
    register()