WeixiangYan/CodeTransOcean huggingface dataset:
Task: Menu



C#: using System;
using System.Collections.Generic;

public class Menu
{
        static void Main(string[] args)
        {
            List<string> menu_items = new List<string>() { "fee fie", "huff and puff", "mirror mirror", "tick tock" };
            
            Console.WriteLine(PrintMenu(menu_items));
            Console.ReadLine();
        }
        private static string PrintMenu(List<string> items)
        {
            if (items.Count == 0)
                return "";

            string input = "";
            int i = -1;
            do
            {
                for (int j = 0; j < items.Count; j++)
                    Console.WriteLine("{0}) {1}", j, items[j]);

                Console.WriteLine("What number?");
                input = Console.ReadLine();

            } while (!int.TryParse(input, out i) || i >= items.Count || i < 0);
            return items[i];
        }
}


Go: package main

import "fmt"

func menu(choices []string, prompt string) string {
    if len(choices) == 0 {
        return ""
    }
    var c int
    for {
        fmt.Println("")
        for i, s := range choices {
            fmt.Printf("%d.  %s\n", i+1, s)
        }
        fmt.Print(prompt)
        _, err := fmt.Scanln(&c)

        if err == nil && c > 0 && c <= len(choices) {
            break
        }
    }
    return choices[c-1]
}

func main() {
    pick := menu(nil, "No prompt")
    fmt.Printf("No choices, result = %q\n", pick)

    choices := []string{
        "fee fie",
        "huff and puff",
        "mirror mirror",
        "tick tock",
    }
    pick = menu(choices, "Enter number: ")
    fmt.Printf("You picked %q\n", pick)
}
Task: Menu



C#: using System;
using System.Collections.Generic;

public class Menu
{
        static void Main(string[] args)
        {
            List<string> menu_items = new List<string>() { "fee fie", "huff and puff", "mirror mirror", "tick tock" };
            
            Console.WriteLine(PrintMenu(menu_items));
            Console.ReadLine();
        }
        private static string PrintMenu(List<string> items)
        {
            if (items.Count == 0)
                return "";

            string input = "";
            int i = -1;
            do
            {
                for (int j = 0; j < items.Count; j++)
                    Console.WriteLine("{0}) {1}", j, items[j]);

                Console.WriteLine("What number?");
                input = Console.ReadLine();

            } while (!int.TryParse(input, out i) || i >= items.Count || i < 0);
            return items[i];
        }
}





Python: def _menu(items):
    for indexitem in enumerate(items):
        print ("  %2i) %s" % indexitem)

def _ok(reply, itemcount):
    try:
        n = int(reply)
        return 0 <= n < itemcount
    except:
        return False
    
def selector(items, prompt):
    'Prompt to select an item from the items'
    if not items: return ''
    reply = -1
    itemcount = len(items)
    while not _ok(reply, itemcount):
        _menu(items)
        
        reply = raw_input(prompt).strip()
    return items[int(reply)]

if __name__ == '__main__':
    items = ['fee fie', 'huff and puff', 'mirror mirror', 'tick tock']
    item = selector(items, 'Which is from the three pigs: ')
    print ("You chose: " + item)
Task: Menu




Go: package main

import "fmt"

func menu(choices []string, prompt string) string {
    if len(choices) == 0 {
        return ""
    }
    var c int
    for {
        fmt.Println("")
        for i, s := range choices {
            fmt.Printf("%d.  %s\n", i+1, s)
        }
        fmt.Print(prompt)
        _, err := fmt.Scanln(&c)

        if err == nil && c > 0 && c <= len(choices) {
            break
        }
    }
    return choices[c-1]
}

func main() {
    pick := menu(nil, "No prompt")
    fmt.Printf("No choices, result = %q\n", pick)

    choices := []string{
        "fee fie",
        "huff and puff",
        "mirror mirror",
        "tick tock",
    }
    pick = menu(choices, "Enter number: ")
    fmt.Printf("You picked %q\n", pick)
}




Python: def _menu(items):
    for indexitem in enumerate(items):
        print ("  %2i) %s" % indexitem)

def _ok(reply, itemcount):
    try:
        n = int(reply)
        return 0 <= n < itemcount
    except:
        return False
    
def selector(items, prompt):
    'Prompt to select an item from the items'
    if not items: return ''
    reply = -1
    itemcount = len(items)
    while not _ok(reply, itemcount):
        _menu(items)
        
        reply = raw_input(prompt).strip()
    return items[int(reply)]

if __name__ == '__main__':
    items = ['fee fie', 'huff and puff', 'mirror mirror', 'tick tock']
    item = selector(items, 'Which is from the three pigs: ')
    print ("You chose: " + item)
Task: Menu







Python: def _menu(items):
    for indexitem in enumerate(items):
        print ("  %2i) %s" % indexitem)

def _ok(reply, itemcount):
    try:
        n = int(reply)
        return 0 <= n < itemcount
    except:
        return False
    
def selector(items, prompt):
    'Prompt to select an item from the items'
    if not items: return ''
    reply = -1
    itemcount = len(items)
    while not _ok(reply, itemcount):
        _menu(items)
        
        reply = raw_input(prompt).strip()
    return items[int(reply)]

if __name__ == '__main__':
    items = ['fee fie', 'huff and puff', 'mirror mirror', 'tick tock']
    item = selector(items, 'Which is from the three pigs: ')
    print ("You chose: " + item)


VB: 
Function Menu(ArrList, Prompt)
    Select Case False   
        Case IsArray(ArrList)
           Menu = ""   
           Exit Function
        Case UBound(ArrList) >= LBound(ArrList)
           Menu = ""   
           Exit Function
    End Select
    
    Do While True
        For i = LBound(ArrList) To UBound(ArrList)
            WScript.StdOut.WriteLine((i + 1) & ". " & ArrList(i))
        Next
        WScript.StdOut.Write(Prompt)
        Choice = WScript.StdIn.ReadLine
        
        If IsNumeric(Choice) Then   
            If CStr(CLng(Choice)) = Choice Then   
                Index = Choice - 1   
                
                If LBound(ArrList) <= Index And Index <= UBound(ArrList) Then
                    Exit Do
                End If
            End If
        End If
        WScript.StdOut.WriteLine("Invalid choice.")
    Loop
    Menu = ArrList(Index)
End Function


Sample = Array("fee fie", "huff and puff", "mirror mirror", "tick tock")
InputText = "Which is from the three pigs: "
WScript.StdOut.WriteLine("Output: " & Menu(Sample, InputText))
Task: Menu




Go: package main

import "fmt"

func menu(choices []string, prompt string) string {
    if len(choices) == 0 {
        return ""
    }
    var c int
    for {
        fmt.Println("")
        for i, s := range choices {
            fmt.Printf("%d.  %s\n", i+1, s)
        }
        fmt.Print(prompt)
        _, err := fmt.Scanln(&c)

        if err == nil && c > 0 && c <= len(choices) {
            break
        }
    }
    return choices[c-1]
}

func main() {
    pick := menu(nil, "No prompt")
    fmt.Printf("No choices, result = %q\n", pick)

    choices := []string{
        "fee fie",
        "huff and puff",
        "mirror mirror",
        "tick tock",
    }
    pick = menu(choices, "Enter number: ")
    fmt.Printf("You picked %q\n", pick)
}





VB: 
Function Menu(ArrList, Prompt)
    Select Case False   
        Case IsArray(ArrList)
           Menu = ""   
           Exit Function
        Case UBound(ArrList) >= LBound(ArrList)
           Menu = ""   
           Exit Function
    End Select
    
    Do While True
        For i = LBound(ArrList) To UBound(ArrList)
            WScript.StdOut.WriteLine((i + 1) & ". " & ArrList(i))
        Next
        WScript.StdOut.Write(Prompt)
        Choice = WScript.StdIn.ReadLine
        
        If IsNumeric(Choice) Then   
            If CStr(CLng(Choice)) = Choice Then   
                Index = Choice - 1   
                
                If LBound(ArrList) <= Index And Index <= UBound(ArrList) Then
                    Exit Do
                End If
            End If
        End If
        WScript.StdOut.WriteLine("Invalid choice.")
    Loop
    Menu = ArrList(Index)
End Function


Sample = Array("fee fie", "huff and puff", "mirror mirror", "tick tock")
InputText = "Which is from the three pigs: "
WScript.StdOut.WriteLine("Output: " & Menu(Sample, InputText))
Task: Menu

C: #include <stdio.h>
#include <stdlib.h>
#include <string.h>

const char *menu_select(const char *const *items, const char *prompt);

int
main(void)
{
	const char *items[] = {"fee fie", "huff and puff", "mirror mirror", "tick tock", NULL};
	const char *prompt = "Which is from the three pigs?";

	printf("You chose %s.\n", menu_select(items, prompt));

	return EXIT_SUCCESS;
}

const char *
menu_select(const char *const *items, const char *prompt)
{
	char buf[BUFSIZ];
	int i;
	int choice;
	int choice_max;

	if (items == NULL)
		return NULL;

	do {
		for (i = 0; items[i] != NULL; i++) {
			printf("%d) %s\n", i + 1, items[i]);
		}
		choice_max = i;
		if (prompt != NULL)
			printf("%s ", prompt);
		else
			printf("Choice? ");
		if (fgets(buf, sizeof(buf), stdin) != NULL) {
			choice = atoi(buf);
		}
	} while (1 > choice || choice > choice_max);

	return items[choice - 1];
}






PHP: <?php
$stdin = fopen("php://stdin", "r");
$allowed = array(1 => 'fee fie', 'huff and puff', 'mirror mirror', 'tick tock');

for(;;) {
    foreach ($allowed as $id => $name) {
        echo "  $id: $name\n";
    }
    echo "Which is from the four pigs: ";
    $stdin_string = fgets($stdin, 4096);
    if (isset($allowed[(int) $stdin_string])) {
        echo "You chose: {$allowed[(int) $stdin_string]}\n";
        break;
    }
}
Task: Menu



C#: using System;
using System.Collections.Generic;

public class Menu
{
        static void Main(string[] args)
        {
            List<string> menu_items = new List<string>() { "fee fie", "huff and puff", "mirror mirror", "tick tock" };
            
            Console.WriteLine(PrintMenu(menu_items));
            Console.ReadLine();
        }
        private static string PrintMenu(List<string> items)
        {
            if (items.Count == 0)
                return "";

            string input = "";
            int i = -1;
            do
            {
                for (int j = 0; j < items.Count; j++)
                    Console.WriteLine("{0}) {1}", j, items[j]);

                Console.WriteLine("What number?");
                input = Console.ReadLine();

            } while (!int.TryParse(input, out i) || i >= items.Count || i < 0);
            return items[i];
        }
}




PHP: <?php
$stdin = fopen("php://stdin", "r");
$allowed = array(1 => 'fee fie', 'huff and puff', 'mirror mirror', 'tick tock');

for(;;) {
    foreach ($allowed as $id => $name) {
        echo "  $id: $name\n";
    }
    echo "Which is from the four pigs: ";
    $stdin_string = fgets($stdin, 4096);
    if (isset($allowed[(int) $stdin_string])) {
        echo "You chose: {$allowed[(int) $stdin_string]}\n";
        break;
    }
}
Task: Menu


C++: #include <iostream>
#include <string>
#include <vector>

void print_menu(const std::vector<std::string>& terms)
{
    for (size_t i = 0; i < terms.size(); i++) {
        std::cout << i + 1 << ") " << terms[i] << '\n';
    }
}

int parse_entry(const std::string& entry, int max_number)
{
    int number = std::stoi(entry);
    if (number < 1 || number > max_number) {
        throw std::invalid_argument("");
    }

    return number;
}

std::string data_entry(const std::string& prompt, const std::vector<std::string>& terms)
{
    if (terms.empty()) {
        return "";
    }

    int choice;
    while (true) {
        print_menu(terms);
        std::cout << prompt;

        std::string entry;
        std::cin >> entry;

        try {
            choice = parse_entry(entry, terms.size());
            return terms[choice - 1];
        } catch (std::invalid_argument&) {
            
        }
    }
}

int main()
{
    std::vector<std::string> terms = {"fee fie", "huff and puff", "mirror mirror", "tick tock"};
    std::cout << "You chose: " << data_entry("> ", terms) << std::endl;
}





PHP: <?php
$stdin = fopen("php://stdin", "r");
$allowed = array(1 => 'fee fie', 'huff and puff', 'mirror mirror', 'tick tock');

for(;;) {
    foreach ($allowed as $id => $name) {
        echo "  $id: $name\n";
    }
    echo "Which is from the four pigs: ";
    $stdin_string = fgets($stdin, 4096);
    if (isset($allowed[(int) $stdin_string])) {
        echo "You chose: {$allowed[(int) $stdin_string]}\n";
        break;
    }
}
Task: Menu




Go: package main

import "fmt"

func menu(choices []string, prompt string) string {
    if len(choices) == 0 {
        return ""
    }
    var c int
    for {
        fmt.Println("")
        for i, s := range choices {
            fmt.Printf("%d.  %s\n", i+1, s)
        }
        fmt.Print(prompt)
        _, err := fmt.Scanln(&c)

        if err == nil && c > 0 && c <= len(choices) {
            break
        }
    }
    return choices[c-1]
}

func main() {
    pick := menu(nil, "No prompt")
    fmt.Printf("No choices, result = %q\n", pick)

    choices := []string{
        "fee fie",
        "huff and puff",
        "mirror mirror",
        "tick tock",
    }
    pick = menu(choices, "Enter number: ")
    fmt.Printf("You picked %q\n", pick)
}



PHP: <?php
$stdin = fopen("php://stdin", "r");
$allowed = array(1 => 'fee fie', 'huff and puff', 'mirror mirror', 'tick tock');

for(;;) {
    foreach ($allowed as $id => $name) {
        echo "  $id: $name\n";
    }
    echo "Which is from the four pigs: ";
    $stdin_string = fgets($stdin, 4096);
    if (isset($allowed[(int) $stdin_string])) {
        echo "You chose: {$allowed[(int) $stdin_string]}\n";
        break;
    }
}
Task: Menu





Java: public static String select(List<String> list, String prompt){
    if(list.size() == 0) return "";
    Scanner sc = new Scanner(System.in);
    String ret = null;
    do{
        for(int i=0;i<list.size();i++){
            System.out.println(i + ": "+list.get(i));
        }
        System.out.print(prompt);
        int index = sc.nextInt();
        if(index >= 0 && index < list.size()){
            ret = list.get(index);
        }
    }while(ret == null);
    return ret;
}


PHP: <?php
$stdin = fopen("php://stdin", "r");
$allowed = array(1 => 'fee fie', 'huff and puff', 'mirror mirror', 'tick tock');

for(;;) {
    foreach ($allowed as $id => $name) {
        echo "  $id: $name\n";
    }
    echo "Which is from the four pigs: ";
    $stdin_string = fgets($stdin, 4096);
    if (isset($allowed[(int) $stdin_string])) {
        echo "You chose: {$allowed[(int) $stdin_string]}\n";
        break;
    }
}
Task: Menu






PHP: <?php
$stdin = fopen("php://stdin", "r");
$allowed = array(1 => 'fee fie', 'huff and puff', 'mirror mirror', 'tick tock');

for(;;) {
    foreach ($allowed as $id => $name) {
        echo "  $id: $name\n";
    }
    echo "Which is from the four pigs: ";
    $stdin_string = fgets($stdin, 4096);
    if (isset($allowed[(int) $stdin_string])) {
        echo "You chose: {$allowed[(int) $stdin_string]}\n";
        break;
    }
}


Python: def _menu(items):
    for indexitem in enumerate(items):
        print ("  %2i) %s" % indexitem)

def _ok(reply, itemcount):
    try:
        n = int(reply)
        return 0 <= n < itemcount
    except:
        return False
    
def selector(items, prompt):
    'Prompt to select an item from the items'
    if not items: return ''
    reply = -1
    itemcount = len(items)
    while not _ok(reply, itemcount):
        _menu(items)
        
        reply = raw_input(prompt).strip()
    return items[int(reply)]

if __name__ == '__main__':
    items = ['fee fie', 'huff and puff', 'mirror mirror', 'tick tock']
    item = selector(items, 'Which is from the three pigs: ')
    print ("You chose: " + item)
Task: Menu






PHP: <?php
$stdin = fopen("php://stdin", "r");
$allowed = array(1 => 'fee fie', 'huff and puff', 'mirror mirror', 'tick tock');

for(;;) {
    foreach ($allowed as $id => $name) {
        echo "  $id: $name\n";
    }
    echo "Which is from the four pigs: ";
    $stdin_string = fgets($stdin, 4096);
    if (isset($allowed[(int) $stdin_string])) {
        echo "You chose: {$allowed[(int) $stdin_string]}\n";
        break;
    }
}



VB: 
Function Menu(ArrList, Prompt)
    Select Case False   
        Case IsArray(ArrList)
           Menu = ""   
           Exit Function
        Case UBound(ArrList) >= LBound(ArrList)
           Menu = ""   
           Exit Function
    End Select
    
    Do While True
        For i = LBound(ArrList) To UBound(ArrList)
            WScript.StdOut.WriteLine((i + 1) & ". " & ArrList(i))
        Next
        WScript.StdOut.Write(Prompt)
        Choice = WScript.StdIn.ReadLine
        
        If IsNumeric(Choice) Then   
            If CStr(CLng(Choice)) = Choice Then   
                Index = Choice - 1   
                
                If LBound(ArrList) <= Index And Index <= UBound(ArrList) Then
                    Exit Do
                End If
            End If
        End If
        WScript.StdOut.WriteLine("Invalid choice.")
    Loop
    Menu = ArrList(Index)
End Function


Sample = Array("fee fie", "huff and puff", "mirror mirror", "tick tock")
InputText = "Which is from the three pigs: "
WScript.StdOut.WriteLine("Output: " & Menu(Sample, InputText))
Task: Subtractive generator

C: #include<stdio.h>

#define MOD 1000000000
int state[55], si = 0, sj = 0;

int subrand();

void subrand_seed(int p1)
{
	int i, j, p2 = 1;

	state[0] = p1 % MOD;
	for (i = 1, j = 21; i < 55; i++, j += 21) {
		if (j >= 55) j -= 55;
		state[j] = p2;
		if ((p2 = p1 - p2) < 0) p2 += MOD;
		p1 = state[j];
	}
	si = 0;
	sj = 24;
	for (i = 0; i < 165; i++) subrand();
}

int subrand()
{
	int x;
	if (si == sj) subrand_seed(0);

	if (!si--) si = 54;
	if (!sj--) sj = 54;
	if ((x = state[si] - state[sj]) < 0) x += MOD;

	return state[si] = x;
}

int main()
{
	subrand_seed(292929);
	int i;
	for (i = 0; i < 10; i++) printf("%d\n", subrand());

	return 0;
}



C#: public class SubtractiveGenerator {
    public static int MAX = 1000000000;
    private int[] state;
    private int pos;

    private int mod(int n) {
        return ((n % MAX) + MAX) % MAX;
    }

    public SubtractiveGenerator(int seed) {
        state = new int[55];

        int[] temp = new int[55];
        temp[0] = mod(seed);
        temp[1] = 1;
        for(int i = 2; i < 55; ++i)
            temp[i] = mod(temp[i - 2] - temp[i - 1]);

        for(int i = 0; i < 55; ++i)
            state[i] = temp[(34 * (i + 1)) % 55];

        pos = 54;
        for(int i = 55; i < 220; ++i)
            next();
    }

    public int next() {
        int temp = mod(state[(pos + 1) % 55] - state[(pos + 32) % 55]);
        pos = (pos + 1) % 55;
        state[pos] = temp;
        return temp;
    }

    static void Main(string[] args) {
        SubtractiveGenerator gen = new SubtractiveGenerator(292929);
        for(int i = 220; i < 230; ++i)
            Console.WriteLine(i.ToString() + ": " + gen.next().ToString());
    }
}
Task: Subtractive generator

C: #include<stdio.h>

#define MOD 1000000000
int state[55], si = 0, sj = 0;

int subrand();

void subrand_seed(int p1)
{
	int i, j, p2 = 1;

	state[0] = p1 % MOD;
	for (i = 1, j = 21; i < 55; i++, j += 21) {
		if (j >= 55) j -= 55;
		state[j] = p2;
		if ((p2 = p1 - p2) < 0) p2 += MOD;
		p1 = state[j];
	}
	si = 0;
	sj = 24;
	for (i = 0; i < 165; i++) subrand();
}

int subrand()
{
	int x;
	if (si == sj) subrand_seed(0);

	if (!si--) si = 54;
	if (!sj--) sj = 54;
	if ((x = state[si] - state[sj]) < 0) x += MOD;

	return state[si] = x;
}

int main()
{
	subrand_seed(292929);
	int i;
	for (i = 0; i < 10; i++) printf("%d\n", subrand());

	return 0;
}


C++: 

#include <iostream>
using std::cout;
using std::endl;

#include <boost/array.hpp>
#include <boost/circular_buffer.hpp>

class Subtractive_generator {
private:
    static const int param_i = 55;
    static const int param_j = 24;
    static const int initial_load = 219;
    static const int mod = 1e9;
    boost::circular_buffer<int> r;
public:
    Subtractive_generator(int seed);
    int next(); 
    int operator()(){return next();} 
};

Subtractive_generator::Subtractive_generator(int seed)
:r(param_i)
{
    boost::array<int, param_i> s;
    s[0] = seed;
    s[1] = 1;
    for(int n = 2; n < param_i; ++n){
        int t = s[n-2]-s[n-1];
        if (t < 0 ) t+= mod;
        s[n] = t;
    }

    for(int n = 0; n < param_i; ++n){
	int i = (34 * (n+1)) % param_i;
        r.push_back(s[i]);
    }
    for(int n = param_i; n <= initial_load; ++n) next();
}

int Subtractive_generator::next()
{
    int t = r[0]-r[31];
    if (t < 0) t += mod;
    r.push_back(t);
    return r[param_i-1];
}

int main()
{
    Subtractive_generator rg(292929);

    cout << "result = " << rg() << endl;
    cout << "result = " << rg() << endl;
    cout << "result = " << rg() << endl;
    cout << "result = " << rg() << endl;
    cout << "result = " << rg() << endl;
    cout << "result = " << rg() << endl;
    cout << "result = " << rg() << endl;

    return 0;
}
Task: Subtractive generator

C: #include<stdio.h>

#define MOD 1000000000
int state[55], si = 0, sj = 0;

int subrand();

void subrand_seed(int p1)
{
	int i, j, p2 = 1;

	state[0] = p1 % MOD;
	for (i = 1, j = 21; i < 55; i++, j += 21) {
		if (j >= 55) j -= 55;
		state[j] = p2;
		if ((p2 = p1 - p2) < 0) p2 += MOD;
		p1 = state[j];
	}
	si = 0;
	sj = 24;
	for (i = 0; i < 165; i++) subrand();
}

int subrand()
{
	int x;
	if (si == sj) subrand_seed(0);

	if (!si--) si = 54;
	if (!sj--) sj = 54;
	if ((x = state[si] - state[sj]) < 0) x += MOD;

	return state[si] = x;
}

int main()
{
	subrand_seed(292929);
	int i;
	for (i = 0; i < 10; i++) printf("%d\n", subrand());

	return 0;
}




Go: package main

import (
    "fmt"
    "os"
)






func newSG(i, j, k, s, m, seed int) func() int {
    
    assert(i > 0, "i must be > 0")
    assert(j > 0, "j must be > 0")
    assert(i > j, "i must be > j")
    assert(k > 0, "k must be > 0")
    p, q := i, k
    if p < q {
        p, q = q, p
    }
    for q > 0 {
        p, q = q, p%q
    }
    assert(p == 1, "k, i must be relatively prime")
    assert(s >= i, "s must be >= i")
    assert(m > 0, "m must be > 0")
    assert(seed >= 0, "seed must be >= 0")
    
    arr := make([]int, i)
    a := 0
    b := j
    
    f := func() int {
        if a == 0 {
            a = i
        }
        a--
        if b == 0 {
            b = i
        }
        b--
        t := arr[a] - arr[b]
        if t < 0 {
            t += m
        }
        arr[a] = t
        return t
    }
    
    last := seed
    arr[0] = last
    next := 1
    for i0 := 1; i0 < i; i0++ {
        ii := k * i0 % i
        arr[ii] = next
        next = last - next
        if next < 0 {
            next += m
        }
        last = arr[ii]
    }
    for i0 := i; i0 < s; i0++ {
        f()
    }
    
    return f
}

func assert(p bool, m string) {
    if !p {
        fmt.Println(m)
        os.Exit(1)
    }
}

func main() {
    
    
    ptTest(0, 1, []int{921674862, 250065336, 377506581})

    
    skip := 220
    sg := newSG(55, 24, 21, skip, 1e9, 292929)
    for n := skip; n <= 222; n++ {
        fmt.Printf("r(%d) = %d\n", n, sg())
    }
}

func ptTest(nd, s int, rs []int) {
    sg := newSG(55, 24, 21, 220+nd, 1e9, s)
    for _, r := range rs {
        a := sg()
        if r != a {
            fmt.Println("Fail")
            os.Exit(1) 
        }
    }
}