aboutsummaryrefslogtreecommitdiff
path: root/libgo/runtime/go-rand.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/runtime/go-rand.c')
-rw-r--r--libgo/runtime/go-rand.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/libgo/runtime/go-rand.c b/libgo/runtime/go-rand.c
new file mode 100644
index 0000000..9632efc
--- /dev/null
+++ b/libgo/runtime/go-rand.c
@@ -0,0 +1,18 @@
+// Copyright 2009 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+#include "runtime.h"
+
+uint32
+runtime_fastrand1(void)
+{
+ uint32 x;
+
+ x = m->fastrand;
+ x += x;
+ if(x & 0x80000000L)
+ x ^= 0x88888eefUL;
+ m->fastrand = x;
+ return x;
+}