1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include <stdlib.h> 6 #include <stdio.h> 7 8 #include "eightball.h" 9 10 extern "C" const char* Magic8Ball() { 11 const int NSIDES = 8; 12 const char* answer[NSIDES] = { "YES", "NO", "MAYBE", "MAYBE NOT", 13 "DEFINITELY", "ASK ME TOMORROW", 14 "PARTLY CLOUDY", "42", }; 15 return answer[rand() % NSIDES]; 16 } 17