| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1072 人关注过本帖
标题:休息一下,发个自己拿来买双色球的代码耍,没技术含量,代码很乱,看了别骂我 ...
只看楼主 加入收藏
anthony634
Rank: 6Rank: 6
来 自:西南交大
等 级:贵宾
威 望:24
帖 子:653
专家分:10
注 册:2006-6-8
结帖率:100%
收藏
 问题点数:0 回复次数:1 
休息一下,发个自己拿来买双色球的代码耍,没技术含量,代码很乱,看了别骂我,谢谢
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    btnLucky: TButton;
    Memo1: TMemo;
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    Edit4: TEdit;
    Edit5: TEdit;
    Edit6: TEdit;
    Edit7: TEdit;
    lblMin: TLabel;
    lblMax: TLabel;
    lblBackMax: TLabel;
    lblCreateNum: TLabel;
    lblBaseSeed: TLabel;
    lblFrontNum: TLabel;
    lblBackNum: TLabel;
    procedure btnLuckyClick(Sender: TObject);
  private
    { Private declarations }
    fMin, fMax, fBackMax: Integer;
    fFornt, fBack: Integer;
    function getRandomStr(const aBaseSeed: TLargeInteger): string;
  public
    { Public declarations }
    procedure AfterConstruction(); override;
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

{ TForm1 }

procedure TForm1.AfterConstruction;
begin
  inherited;
  fMin := 0;
  fMax := 0;
  fFornt := 6;
  fBack := 1;
  fBackMax := 16;
  Edit1.Text := '1';
  Edit2.Text := '36';
  Edit3.Text := '1';
  Edit4.Text := '6';
  Edit5.Text := '1';
  Edit6.Text := '16';
  Edit7.Text := '20080418';
end;

function TForm1.getRandomStr(const aBaseSeed: TLargeInteger): string;
var
  I: Integer;
  aTrueBaseSeed: TLargeInteger;
  aRandomVale: TLargeInteger;
  resultStr: string;
  counter: TLargeInteger;
  aList: TStringList;
begin
  Randomize;
  aList := TStringList.Create;
  aList.Sorted := True;
  for I := 0 to fFornt do
  begin
    if QueryPerformanceCounter(counter) then
    begin
      aTrueBaseSeed := Counter + aBaseSeed;
    end
    else
    begin
      aTrueBaseSeed := GetTickCount + aBaseSeed;
    end;
    RandSeed := aTrueBaseSeed mod MaxInt;
    aRandomVale := fMin + Random(fMax);
    aList.Add(IntToStr(aRandomVale));
  end;
  for I := 0 to aList.Count - 1 do
  begin
    resultStr := resultStr + ' ' + aList[i];
  end;
  aList.Clear();
  for I := 0 to fBack - 1 do
  begin
    if QueryPerformanceCounter(counter) then
    begin
      aTrueBaseSeed := Counter + aBaseSeed;
    end
    else
    begin
      aTrueBaseSeed := GetTickCount + aBaseSeed;
    end;
    RandSeed := aTrueBaseSeed mod MaxInt;
    aRandomVale := fMin + Random(fBackMax);
    aList.Add(IntToStr(aRandomVale));
  end;
  for I := 0 to aList.Count - 1 do
  begin
    resultStr := resultStr + '+' + aList[i];
  end;
  aList.Clear();

  Result := Trim(resultStr);
end;

procedure TForm1.btnLuckyClick(Sender: TObject);
var
  aCreateNum: Cardinal;
  I: Integer;
  fBaseSeed: Integer;
begin
  aCreateNum := StrToIntDef(Edit3.Text, 5); // 注数
  fMin := StrToIntDef(Edit1.Text, 0); // 前去最小
  fMax := StrToIntDef(Edit2.Text, 36); // 后区最大
  fFornt := StrToIntDef(Edit4.Text, 6); // 前去个数
  fBack :=  StrToIntDef(Edit5.Text, 1); // 后区个数
  fBackMax := StrToIntDef(Edit6.Text, 16); // 后区最大
  fBaseSeed := StrToIntDef(Edit7.Text, 20080418);  // 基种
  Self.Caption := IntToStr(fBaseSeed);
  for I := 0 to aCreateNum - 1 do
  begin
    Memo1.Lines.Add(getRandomStr(fBaseSeed));
  end;
end;

end.

[[it] 本帖最后由 anthony634 于 2008-4-18 21:45 编辑 [/it]]
搜索更多相关主题的帖子: 含量 代码 技术 休息 
2008-04-18 20:11
缘子弹
Rank: 1
等 级:新手上路
帖 子:184
专家分:0
注 册:2007-4-5
收藏
得分:0 
LZ兄,好久不见,没想到一上来就看见你发代码分享.

2008-04-19 02:36
快速回复:休息一下,发个自己拿来买双色球的代码耍,没技术含量,代码很乱,看了 ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.011739 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved