Перейти к содержимому

Фотография

Генератор лотерейных номеров


  • Авторизуйтесь для ответа в теме
Сообщений в теме: 2

#1 LKhiger

LKhiger

    Активный участник

  • Members
  • PipPip
  • 76 сообщений
  • ФИО:Леонид Хигер
  • Город:NY

Отправлено 06 февраля 2010 - 21:54

Russian Lottery - Gosloto: Russia's New Lotto

Gosloto is Russia's new lottery; it started in October of 2008 with a 6/45 game. The odds of winning the jackpot in a 6/45 game are 1 in 8,145,060. Albert Begrakyan managed to beat the odds and won 100 million rubles ($2,968,372 USD) in April of 2009.

Albert Begrakyan's win was the biggest ever in Gosloto's short history. He was so afraid of somebody finding out that he won the lottery that he hired bodyguards to travel with him to Moscow to claim his prize. But he got his money and is now safe and sound with the money in the bank.

Russia's lottery is way different than lotteries, say, in North America. Canadian and American lotteries are government run, whereas Russia's new Gosloto is run by a private businessman. His name is Sandor Demjan. This is crazy. As most people probably know, lotteries generate billions in profit. And, it is usually a government monopoly as private businesses are prohibited from creating a lottery. Giving a private businessman the opportunity to create a lottery is like him winning the lottery himself. But instead of winning millions, he wins billions. Having the only lottery franchise in a country like Russia is like starting the most lucrative business ever - with absolutely no risk whatsoever. It really is crazy.

Now, Sandor Demjan does have to give a percentage of all lottery sales from Gosloto to government programs. We couldn't find out the exact percentage, but we still think this situation is crazy.


with Goslotto_tickets (tickets, R, K, Lsw, L1, L2, L3, L4, L5, L6) as
(select int(77),int(0),int(0), 'N',
		char('', 2), char('', 2), char('', 2),   
		char('', 2), char('', 2), char('', 2)		
   from sysibm.sysdummy1 
union all
select tickets, R + 12, 
	K + case when M1 > '00' and M2 > '00' and M3 > '00' and 
				  M4 > '00' and M5 > '00' and M6 > '00' 
			 then 1
			 else 0
		end,
case when M1 > '00' and M2 > '00' and M3 > '00' and 
		  M4 > '00' and M5 > '00' and M6 > '00' 
	 then 'Y'
	 else 'N'
end,
M1, M2, M3, M4, M5, M6 
from Goslotto_tickets lt,
table (
select max(L1) M1, max(L2) M2, max(L3) M3, 
	   max(L4) M4, max(L5) M5, max(L6) M6  
from table 
(select  L1, L2, L3, L4, L5, L6 
from table 
(select  L1, L2, L3, L4, L5, L6 
from table
(select 
substr(char(rand(R)),		3,  1)	   ||  
substr(char(rand(R + 1)),  4,  1)  L1, 
		substr(char(rand(R + 2)),  5,  1) ||  
substr(char(rand(R + 3)),  6,  1)  L2, 
		substr(char(rand(R + 4)),  7,  1) ||  
substr(char(rand(R + 5)),  8,  1)  L3, 
		substr(char(rand(R + 6)),  9,  1) ||  
substr(char(rand(R + 7)),  10, 1)  L4,
		substr(char(rand(R + 8)),  10, 1) ||  
substr(char(rand(R + 9)),  11, 1)  L5,
		substr(char(rand(R + 10)), 12, 1) ||  
substr(char(rand(R + 11)), 13, 1)  L6	
		 
from sysibm.sysdummy1 ) rd1
where 
L1 between '01' and '45' and
L2 between '01' and '45' and
L3 between '01' and '45' and
L4 between '01' and '45' and
L5 between '01' and '45' and
L6 between '01' and '45'  
) rd2 
Where 
L1 not in (L2, L3, L4, L5, L6) and
L2 not in (L1, L3, L4, L5, L6) and
L3 not in (L1, L2, L4, L5, L6) and
L4 not in (L1, L2, L3, L5, L6) and
L6 not in (L1, L2, L3, L4, L5) 
union all
select '00' L1, '00' L2, '00' L3, '00' L4, '00' L5, '00' L6 
from sysibm.sysdummy1 ) rd3 ) rdm
where K <= tickets - 1
) 
select distinct L1, L2, L3, L4, L5, L6   
  from Goslotto_tickets 
   where Lsw = 'Y'

L1 L2 L3 L4 L5 L6

01 04 24 15 12 08
01 29 30 17 07 24
01 32 39 26 45 19
04 18 45 36 17 07
04 26 35 06 31 24
04 28 21 29 03 41
05 11 26 15 28 42
05 15 45 14 32 39
05 22 35 39 43 08
06 10 17 41 01 13
06 40 34 12 44 03
07 21 24 18 32 11
07 26 28 12 19 30
08 18 25 28 12 09
08 31 19 06 39 11
09 07 02 45 36 33
09 10 25 12 04 36
09 14 12 29 31 01
09 18 19 07 15 38
09 22 30 36 23 21
09 33 21 25 20 14
10 06 31 24 21 34
10 37 07 01 24 03
10 38 26 27 34 08
11 35 21 08 28 02
12 15 37 21 01 03
13 35 11 25 31 45
14 39 34 05 30 40
14 41 07 36 22 05
15 34 07 01 18 33
15 38 23 21 39 09
16 20 10 23 45 07
16 38 26 32 11 30
17 15 03 22 21 28
18 01 10 44 25 40
18 03 31 20 08 37
18 09 13 32 42 33
18 42 41 20 11 21
18 44 30 02 37 16
19 13 11 16 14 34
19 22 05 14 37 43
20 12 23 29 14 27
20 12 42 35 28 14
20 18 15 39 42 23
21 18 12 01 25 37
21 44 32 45 10 02
24 06 25 05 43 23
25 09 37 01 22 29
25 22 17 09 15 18
26 11 22 34 03 45
27 02 33 04 25 38
27 24 42 41 15 11
28 12 25 27 07 36
29 35 30 38 34 15
29 41 17 24 13 33
29 42 15 06 32 09
30 12 03 45 07 01
30 17 28 12 41 15
30 37 01 17 15 40
31 34 04 41 19 25
32 07 36 27 02 33
33 37 31 10 43 22
34 12 19 14 08 44
34 22 26 04 36 25
35 24 30 06 42 32
37 14 06 09 30 07
37 42 07 16 23 02
38 05 16 25 39 32
39 09 08 05 37 33
39 14 26 37 42 30
41 08 39 14 01 44
41 33 02 10 36 11
42 16 13 27 15 43
42 21 17 35 10 43
42 32 33 13 25 28
45 23 20 02 38 08
45 34 10 28 21 07


Lenny
  • 0

#2 LKhiger

LKhiger

    Активный участник

  • Members
  • PipPip
  • 76 сообщений
  • ФИО:Леонид Хигер
  • Город:NY

Отправлено 20 февраля 2010 - 17:02

Кстати, вы можете заметить что результаты выдаются линейно не сортированными: "01 04 24 15 12 08", и так далее.

Небольшое изменение кода позволит нам выводить результат в сортированном виде.

Замечу только, что это приведёт к значительному увеличению времени получения номеров.

Вам остаётся только выбрать какой код для вас более приемлем.

with Goslotto_tickets (tickets, R, K, Lsw, L1, L2, L3, L4, L5, L6) as
(select int(77),int(0),int(0), 'N',
		char('', 2), char('', 2), char('', 2),   
		char('', 2), char('', 2), char('', 2)		
   from sysibm.sysdummy1 
union all
select tickets, R + 12, 
	K + case when M1 > '00' and M2 > '00' and M3 > '00' and 
				  M4 > '00' and M5 > '00' and M6 > '00' 
			 then 1
			 else 0
		end,
case when M1 > '00' and M2 > '00' and M3 > '00' and 
		  M4 > '00' and M5 > '00' and M6 > '00' 
	 then 'Y'
	 else 'N'
end,
M1, M2, M3, M4, M5, M6 
from Goslotto_tickets lt,
table (
select max(L1) M1, max(L2) M2, max(L3) M3, 
	   max(L4) M4, max(L5) M5, max(L6) M6  
from table 
(select  L1, L2, L3, L4, L5, L6 
from table 
(select  L1, L2, L3, L4, L5, L6 
from table
(select 
substr(char(rand(R)),		3,  1)	   ||  
substr(char(rand(R + 1)),  4,  1)  L1, 
		substr(char(rand(R + 2)),  5,  1) ||  
substr(char(rand(R + 3)),  6,  1)  L2, 
		substr(char(rand(R + 4)),  7,  1) ||  
substr(char(rand(R + 5)),  8,  1)  L3, 
		substr(char(rand(R + 6)),  9,  1) ||  
substr(char(rand(R + 7)),  10, 1)  L4,
		substr(char(rand(R + 8)),  10, 1) ||  
substr(char(rand(R + 9)),  11, 1)  L5,
		substr(char(rand(R + 10)), 12, 1) ||  
substr(char(rand(R + 11)), 13, 1)  L6	
		 
from sysibm.sysdummy1 ) rd1
where 
L1 between '01' and '45' and
L2 between '01' and '45' and
L3 between '01' and '45' and
L4 between '01' and '45' and
L5 between '01' and '45' and
L6 between '01' and '45'  
) rd2 

Where 
L1 <L2 and
L2 <L3 and
L3 <L4 and
L4 <L5 and
L5 <L6 

Union All
select '00' L1, '00' L2, '00' L3, '00' L4, '00' L5, '00' L6 
from sysibm.sysdummy1 ) rd3 ) rdm
where K <= tickets - 1
) 
select distinct L1, L2, L3, L4, L5, L6   
  from Goslotto_tickets 
   where Lsw = 'Y'

Lenny
  • 0

#3 LKhiger

LKhiger

    Активный участник

  • Members
  • PipPip
  • 76 сообщений
  • ФИО:Леонид Хигер
  • Город:NY

Отправлено 26 июня 2010 - 11:51

Pick 10 from 80 (New York)

Select 10 numbers from 1 through 80....


with Pick_10_NY
(tickets, R, K, Lsw, L1, L2, L3, L4, L5, L6, L7, L8, L9, L10 ) as
(select int(20),int(0),int(0), 'N',
		char('', 2), char('', 2), char('', 2),   
		char('', 2), char('', 2), char('', 2),
		char('', 2), char('', 2), char('', 2), 
		char('', 2)			   
   from sysibm.sysdummy1 
union all
select 
tickets, 
R + 20, 
	K + case when M1  > '00' and M2 > '00' and M3 > '00' and 
				  M4  > '00' and M5 > '00' and M6 > '00' and
				  M7  > '00' and M8 > '00' and M9 > '00' and
				  M10 > '00'
			 then 1
			 else 0
		end,
case when M1  > '00' and M2 > '00' and M3 > '00' and 
		  M4  > '00' and M5 > '00' and M6 > '00' and
		  M7  > '00' and M8 > '00' and M9 > '00' and
		  M10 > '00'
	 then 'Y'
	 else 'N'
end,
M1, M2, M3, M4, M5, M6, M7, M8, M9, M10 
from Pick_10_NY lt,
table (
select max(L1)  M1, max(L2) M2, max(L3) M3, 
	   max(L4)  M4, max(L5) M5, max(L6) M6, 
	   max(L7)  M7, max(L8) M8, max(L9) M9,
	   max(L10) M10   
from 
(select  L1, L2, L3, L4, L5, L6, L7, L8, L9, L10  
from
(select  L1, L2, L3, L4, L5, L6, L7, L8, L9, L10  
from
(select 
		substr(char(rand(R)),  3,  1)	 ||  
substr(char(rand(R + 1)),  4,  1)  L1, 
		substr(char(rand(R + 2)),  5,  1) ||  
substr(char(rand(R + 3)),  6,  1)  L2, 
		substr(char(rand(R + 4)),  7,  1) ||  
substr(char(rand(R + 5)),  8,  1)  L3, 
		substr(char(rand(R + 6)),  9,  1) ||  
substr(char(rand(R + 7)),  10, 1)  L4,
		substr(char(rand(R + 8)),  10, 1) ||  
substr(char(rand(R + 9)),  11, 1)  L5,
		substr(char(rand(R + 10)), 12, 1) ||  
substr(char(rand(R + 11)), 13, 1)  L6, 
		substr(char(rand(R + 12)), 14, 1) ||  
substr(char(rand(R + 13)), 15, 1)  L7,  
		substr(char(rand(R + 14)), 3,  1) ||  
substr(char(rand(R + 15)), 4, 1)  L8,  
		substr(char(rand(R + 16)), 5,  1) ||  
substr(char(rand(R + 17)), 6, 1)  L9, 
		substr(char(rand(R + 18)), 7,  1) ||  
substr(char(rand(R + 19)), 8, 1) L10 
from sysibm.sysdummy1 ) rd1
where 
L1  between '01' and '80' and
L2  between '01' and '80' and
L3  between '01' and '80' and
L4  between '01' and '80' and
L5  between '01' and '80' and
L6  between '01' and '80' and
L7  between '01' and '80' and
L8  between '01' and '80' and
L9  between '01' and '80' and
L10 between '01' and '80' 
) rd2 
Where 
L1  not in (L2, L3, L4, L5, L6, L7, L8, L9, L10) and
L2  not in (L1, L3, L4, L5, L6, L7, L8, L9, L10) and
L3  not in (L1, L2, L4, L5, L6, L7, L8, L9, L10) and
L4  not in (L1, L2, L3, L5, L6, L7, L8, L9, L10) and
L5  not in (L1, L2, L3, L4, L6, L7, L8, L9, L10) and
L6  not in (L1, L2, L3, L4, L5, L7, L8, L9, L10) and
L7  not in (L1, L2, L3, L4, L5, L6, L8, L9, L10) and
L8  not in (L1, L2, L3, L4, L5, L6, L7, L9, L10) and
L9  not in (L1, L2, L3, L4, L5, L6, L7, L8, L10) and
L10 not in (L1, L2, L3, L4, L5, L6, L7, L8, L9 )
union all
select '00' L1, '00' L2, '00' L3, '00' L4, '00' L5, '00' L6, 
	   '00' L7, '00' L8, '00' L9, '00' L10
from sysibm.sysdummy1 ) rd3 ) rdm
where K <= tickets - 1
) 
select L1, L2, L3, L4, L5, L6, L7, L8, L9, L10  
  from Pick_10_NY 
   where Lsw = 'Y'
order by 1;

Result:

L1 L2 L3 L4 L5 L6 L7 L8 L9 L10

11 33 07 06 69 31 48 17 53 34
14 30 47 32 80 25 34 20 66 45
17 50 48 07 44 30 80 06 26 27
21 69 09 39 80 13 66 46 15 61
21 68 12 37 09 39 51 24 27 15
23 75 11 72 07 13 14 60 65 71
24 56 01 47 11 18 43 21 03 04
33 49 29 10 68 13 06 48 71 75
39 41 17 24 13 33 26 55 29 67
40 77 61 25 68 52 37 65 76 51
42 44 33 05 34 66 17 70 46 54
42 59 08 62 05 38 11 51 75 69
44 28 55 46 47 65 39 49 09 02
46 63 59 26 42 27 62 35 54 17
46 18 36 59 26 22 61 38 48 04
60 40 45 77 05 39 20 43 25 61
65 40 04 62 78 21 07 18 20 17
72 46 57 51 79 28 76 73 56 64
77 18 46 25 65 45 06 56 53 02
78 64 61 39 74 01 29 14 03 27


Lenny
  • 0


Количество пользователей, читающих эту тему: 0

0 пользователей, 0 гостей, 0 анонимных