File tree Expand file tree Collapse file tree 3 files changed +15
-13
lines changed
Expand file tree Collapse file tree 3 files changed +15
-13
lines changed Original file line number Diff line number Diff line change @@ -324,12 +324,6 @@ const randMax* = 0x7FFFFFFF
324324
325325randSeed := uint(1)
326326
327- fn srand*(seed: int) {
328- if seed > 0 {
329- randSeed = seed
330- }
331- }
332-
333327fn rand*(): int {
334328 // xorshift
335329 randSeed ~= randSeed << 13
@@ -342,6 +336,13 @@ fn frand*(): real {
342336 return real(rand()) / randMax
343337}
344338
339+ fn srand*(seed: int) {
340+ if seed > 0 {
341+ randSeed = seed
342+ rand()
343+ }
344+ }
345+
345346// Time
346347
347348type DateTime* = struct {
Original file line number Diff line number Diff line change @@ -335,12 +335,6 @@ static const char *runtimeModuleSources[] = {
335335"\n"
336336"randSeed := uint(1)\n"
337337"\n"
338- "fn srand*(seed: int) {\n"
339- " if seed > 0 {\n"
340- " randSeed = seed\n"
341- " }\n"
342- "}\n"
343- "\n"
344338"fn rand*(): int {\n"
345339" // xorshift\n"
346340" randSeed ~= randSeed << 13\n"
@@ -353,6 +347,13 @@ static const char *runtimeModuleSources[] = {
353347" return real(rand()) / randMax\n"
354348"}\n"
355349"\n"
350+ "fn srand*(seed: int) {\n"
351+ " if seed > 0 {\n"
352+ " randSeed = seed\n"
353+ " rand()\n"
354+ " }\n"
355+ "}\n"
356+ "\n"
356357"// Time\n"
357358"\n"
358359"type DateTime* = struct {\n"
You can’t perform that action at this time.
0 commit comments