Skip to content

Commit 0448b64

Browse files
committed
random.sys is documented, #26 is done
1 parent 0a8669d commit 0448b64

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

7Sharp/Intrerpreter/SysLibraries/LibRandom.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System;
1+
using _7Sharp.Manual;
2+
using System;
23
using System.Collections.Generic;
34
using System.Linq;
45
using System.Text;
@@ -31,10 +32,13 @@ public override void Import(ref InterpreterState state)
3132
}));
3233
}
3334

35+
[ManualDocs("setSeed", "{\"title\":\"setSeed(seed)\",\"sections\":[{\"header\":\"Syntax\",\"text\":[{\"text\":\"setSeed(<seed>);\"}]},{\"header\":\"Behavior\",\"text\":[{\"text\":\"Set the RNG seed to \"},{\"text\":\"seed\",\"color\":\"Green\"}]}]}")]
3436
private void SetSeed(int seed) => RNG = new Random(seed);
3537

38+
[ManualDocs("next", "{\"title\":\"next()\",\"sections\":[{\"header\":\"Syntax\",\"text\":[{\"text\":\"next();\"}]},{\"header\":\"Behavior\",\"text\":[{\"text\":\"Get a random 32-bit integer. (-2.147 billion to 2.147 billion)\"}]}]}")]
3639
private static int Next() => RNG.Next();
3740

41+
[ManualDocs("nextInt", "{\"title\":\"nextInt(min, max)\",\"sections\":[{\"header\":\"Syntax\",\"text\":[{\"text\":\"nextInt(<min>, <max>);\"}]},{\"header\":\"Behavior\",\"text\":[{\"text\":\"Get a random integer between \"},{\"text\":\"min\",\"color\":\"Green\"},{\"text\":\" and \"},{\"text\":\"max\",\"color\":\"Green\"}]}]}")]
3842
private static int NextInt(int min, int max)
3943
{
4044
if (max < min)
@@ -44,6 +48,7 @@ private static int NextInt(int min, int max)
4448
return RNG.Next(min, max + 1);
4549
}
4650

51+
[ManualDocs("nextDouble", "{\"title\":\"nextDouble(min, max)\",\"sections\":[{\"header\":\"Syntax\",\"text\":[{\"text\":\"nextDouble(<min>, <max>);\"}]},{\"header\":\"Behavior\",\"text\":[{\"text\":\"Get a random doubleeger between \"},{\"text\":\"min\",\"color\":\"Green\"},{\"text\":\" and \"},{\"text\":\"max\",\"color\":\"Green\"}]}]}")]
4752
private static double NextDouble(double min, double max)
4853
{
4954
if (max < min)

0 commit comments

Comments
 (0)