- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
using System;
using System.Threading;
using System.Threading.Tasks;
namespace ConsoleApplication23 {
class InternalRandom {
static double x;
Task t, t2;
public InternalRandom() {
t = new Task(ThreadFunc);
t.Start();
t2 = new Task(ThreadFunc);
t2.Start();
}
public double Next() {
return x;
}
public double Next(double max) {
x+=7;
return NORMALNYYREM(x,max);
//return Math.IEEERemainder(max, x);
}
static double NORMALNYYREM(double A,double B) {
return A - ((double)((long)(A/B))) * B;
}
static void ThreadFunc() {
while(true) {
x += 1;
}
}
}
class Program {
static InternalRandom ir;
static void Main(string[] args) {
ir = new InternalRandom();
for(int i = 1; i <= 20; i++) {
Console.WriteLine( "#"+i+" = "+ Random() );
}
Console.ReadLine();
//Environment.Exit(0);
}
static double Random() {
return ir.Next(10);
}
}
}
partizanes 19.07.2016 13:03 # +16
Soul_re@ver 19.07.2016 13:08 # +19
Dummy00001 19.07.2016 16:20 # +15
guest 19.07.2016 14:59 # +15