blob: 2b309c77cb49478ac64b0cd6621e923126ee9e3e [file] [log] [blame]
zimmermann@webkit.org1604d702008-12-16 21:15:22 +00001/*
zimmermann@webkit.orge6128472008-12-22 02:22:10 +00002 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
zimmermann@webkit.org1604d702008-12-16 21:15:22 +00003 *
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.com92047332014-03-15 04:08:27 +000013 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
zimmermann@webkit.org1604d702008-12-16 21:15:22 +000014 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
mjs@apple.com92047332014-03-15 04:08:27 +000016 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
zimmermann@webkit.org1604d702008-12-16 21:15:22 +000017 * 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.comddb46d22018-10-15 14:24:49 +000026#pragma once
zimmermann@webkit.org1604d702008-12-16 21:15:22 +000027
28namespace WTF {
29
ggaren@apple.com33f45062018-10-25 17:41:35 +000030// Returns a cryptographically secure pseudo-random number in the range [0, 1).
commit-queue@webkit.org105fbb32013-03-08 05:49:46 +000031WTF_EXPORT_PRIVATE double randomNumber();
zimmermann@webkit.org1604d702008-12-16 21:15:22 +000032
ggaren@apple.com33f45062018-10-25 17:41:35 +000033// Returns a cheap pseudo-random number in the range (0, UINT_MAX].
34WTF_EXPORT_PRIVATE unsigned weakRandomUint32();
35
zimmermann@webkit.org1604d702008-12-16 21:15:22 +000036}
37
ukai@chromium.org8d421072010-05-07 07:32:59 +000038using WTF::randomNumber;
ggaren@apple.com33f45062018-10-25 17:41:35 +000039using WTF::weakRandomUint32;