zimmermann@webkit.org | 1604d70 | 2008-12-16 21:15:22 +0000 | [diff] [blame] | 1 | /* |
zimmermann@webkit.org | e612847 | 2008-12-22 02:22:10 +0000 | [diff] [blame] | 2 | * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) |
zimmermann@webkit.org | 1604d70 | 2008-12-16 21:15:22 +0000 | [diff] [blame] | 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions |
| 6 | * are met: |
| 7 | * 1. Redistributions of source code must retain the above copyright |
| 8 | * notice, this list of conditions and the following disclaimer. |
| 9 | * 2. Redistributions in binary form must reproduce the above copyright |
| 10 | * notice, this list of conditions and the following disclaimer in the |
| 11 | * documentation and/or other materials provided with the distribution. |
| 12 | * |
mjs@apple.com | 9204733 | 2014-03-15 04:08:27 +0000 | [diff] [blame] | 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY |
zimmermann@webkit.org | 1604d70 | 2008-12-16 21:15:22 +0000 | [diff] [blame] | 14 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 15 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
mjs@apple.com | 9204733 | 2014-03-15 04:08:27 +0000 | [diff] [blame] | 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR |
zimmermann@webkit.org | 1604d70 | 2008-12-16 21:15:22 +0000 | [diff] [blame] | 17 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 18 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 19 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 20 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 21 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 | */ |
| 25 | |
achristensen@apple.com | ddb46d2 | 2018-10-15 14:24:49 +0000 | [diff] [blame] | 26 | #pragma once |
zimmermann@webkit.org | 1604d70 | 2008-12-16 21:15:22 +0000 | [diff] [blame] | 27 | |
| 28 | namespace WTF { |
| 29 | |
ggaren@apple.com | 33f4506 | 2018-10-25 17:41:35 +0000 | [diff] [blame] | 30 | // Returns a cryptographically secure pseudo-random number in the range [0, 1). |
commit-queue@webkit.org | 105fbb3 | 2013-03-08 05:49:46 +0000 | [diff] [blame] | 31 | WTF_EXPORT_PRIVATE double randomNumber(); |
zimmermann@webkit.org | 1604d70 | 2008-12-16 21:15:22 +0000 | [diff] [blame] | 32 | |
ggaren@apple.com | 33f4506 | 2018-10-25 17:41:35 +0000 | [diff] [blame] | 33 | // Returns a cheap pseudo-random number in the range (0, UINT_MAX]. |
| 34 | WTF_EXPORT_PRIVATE unsigned weakRandomUint32(); |
| 35 | |
zimmermann@webkit.org | 1604d70 | 2008-12-16 21:15:22 +0000 | [diff] [blame] | 36 | } |
| 37 | |
ukai@chromium.org | 8d42107 | 2010-05-07 07:32:59 +0000 | [diff] [blame] | 38 | using WTF::randomNumber; |
ggaren@apple.com | 33f4506 | 2018-10-25 17:41:35 +0000 | [diff] [blame] | 39 | using WTF::weakRandomUint32; |