mirror of
https://github.com/dart-lang/sdk
synced 2024-09-20 04:21:32 +00:00
d366f9619a
- Remove random build-id. - Replace build time in embedded version string with commit time. - Remove timestamps from Observatory tarball. - Zero-initialize skipped bytes in snapshot streams. - Fix uninitialized fields in PatchClass, Script and Library. - Disable (under flag) random identity hashes and concurrent GC. Bug: https://github.com/dart-lang/sdk/issues/31427 Change-Id: I3e95de679c8372841cd27ca60df78d9b00ffbfe1 Reviewed-on: https://dart-review.googlesource.com/22901 Commit-Queue: Ryan Macnak <rmacnak@google.com> Reviewed-by: Zach Anderson <zra@google.com>
41 lines
858 B
C++
41 lines
858 B
C++
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
#ifndef RUNTIME_VM_RANDOM_H_
|
|
#define RUNTIME_VM_RANDOM_H_
|
|
|
|
#include "vm/allocation.h"
|
|
#include "vm/flags.h"
|
|
#include "vm/globals.h"
|
|
|
|
namespace dart {
|
|
|
|
DECLARE_FLAG(uint64_t, random_seed);
|
|
|
|
class Random {
|
|
public:
|
|
Random();
|
|
// Seed must be non-zero.
|
|
explicit Random(uint64_t seed);
|
|
~Random();
|
|
|
|
uint32_t NextUInt32();
|
|
uint64_t NextUInt64() {
|
|
return (static_cast<uint64_t>(NextUInt32()) << 32) |
|
|
static_cast<uint64_t>(NextUInt32());
|
|
}
|
|
|
|
private:
|
|
void NextState();
|
|
void Initialize(uint64_t seed);
|
|
|
|
uint64_t _state;
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(Random);
|
|
};
|
|
|
|
} // namespace dart
|
|
|
|
#endif // RUNTIME_VM_RANDOM_H_
|