ruby-qrng 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "rake/testtask"
2
+
3
+ Rake::TestTask.new do |t|
4
+ t.libs << "lib"
5
+ t.test_files = Dir["test/**/*_test.rb"]
6
+ end
data/qrng/qrng.rb ADDED
@@ -0,0 +1,54 @@
1
+ puts 'teste'
2
+ puts RUBY_VERSION
3
+ require 'openssl'
4
+ require 'open-uri'
5
+ require 'rexml/document'
6
+ require 'openssl'
7
+ require "cgi"
8
+ require 'json'
9
+
10
+ OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
11
+ def random(tamanho)
12
+ p random = REXML::XPath.match(REXML::Document.new(open("https://qrng.anu.edu.au/RawChar.php").read), "//td")[0].text.split('').map(&:ord).map(&:inspect).join('')[3..1027]
13
+ puts random[3..3+tamanho-1]
14
+ end
15
+
16
+ # random(30)
17
+
18
+ def random2(inicio,fim)
19
+ random = REXML::XPath.match(REXML::Document.new(open("https://qrng.anu.edu.au/RawChar.php").read), "//td")[0].text.split('').map(&:ord).map(&:inspect).join('')[3..1027]
20
+ for i in 0..random.length
21
+ if (random[i].to_i>=inicio && random[i].to_i<=fim)
22
+ return p random[i]
23
+ else
24
+ i+=1
25
+ end
26
+ end
27
+ end
28
+
29
+ # random2(2,9)
30
+ 20.times do
31
+ random2(0,9)
32
+ end
33
+
34
+
35
+ def random3(inicio,fim)
36
+ p inicio.to_s.length
37
+ p fim.to_s.length
38
+ p random = REXML::XPath.match(REXML::Document.new(open("https://qrng.anu.edu.au/RawChar.php").read), "//td")[0].text.split('').map(&:ord).map(&:inspect).join('')[3..1027]
39
+ for i in 0..random.length
40
+ if (random[i].to_i>=inicio.to_s.length && random[i].to_i<=fim.to_s.length)
41
+ return p numero = random[i]
42
+ else
43
+ i+=1
44
+ end
45
+ end
46
+ end
47
+
48
+ # random3(50,900000)
49
+
50
+
51
+
52
+
53
+
54
+
data/ruby_qrnq.gemspec ADDED
@@ -0,0 +1,10 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = "ruby-qrng"
3
+ s.version = "0.1.0"
4
+ s.description = "qrng.anu.edu.au offers true random numbers to anyone on the internet. The random numbers are generated in real-time in our lab by measuring the quantum fluctuations of the vacuum. The vacuum is described very differently in the quantum mechanical context than in the classical context. Traditionally, a vacuum is considered as a space that is empty of matter or photons. Quantum mechanically, however, that same space resembles a sea of virtual particles appearing and disappearing all the time. This result is due to the fact that the vacuum still possesses a zero-point energy. Consequently, the electromagnetic field of the vacuum exhibits random fluctuations in phase and amplitude at all frequencies. By carefully measuring these fluctuations, we are able to generate ultra-high bandwidth random numbers."
5
+ s.summary = "True adn real-time random numbers qrng.anu.edu.au"
6
+ s.author = "Henrique Utsch"
7
+ s.email = "henriqueutsch@gmail.com"
8
+ s.homepage = "https://github.com/henriqueutsch/Ruby-qrng"
9
+ s.files = Dir["{lib/**/*.rb,README.rdoc,test/**/*.rb,qrng/*.rb,Rakefile,*.gemspec}"]
10
+ end
@@ -0,0 +1,8 @@
1
+ require "test/unit"
2
+ load "../eva-ia-robot.rb"
3
+
4
+ class HelloWorldTest < Test::Unit::TestCase
5
+ def test_say_hello_to_the_world
6
+ assert_equal "Hello World!", HelloWorld.say
7
+ end
8
+ end
metadata ADDED
@@ -0,0 +1,59 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ruby-qrng
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Henrique Utsch
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-12-30 00:00:00.000000000 -02:00
13
+ default_executable:
14
+ dependencies: []
15
+ description: qrng.anu.edu.au offers true random numbers to anyone on the internet.
16
+ The random numbers are generated in real-time in our lab by measuring the quantum
17
+ fluctuations of the vacuum. The vacuum is described very differently in the quantum
18
+ mechanical context than in the classical context. Traditionally, a vacuum is considered
19
+ as a space that is empty of matter or photons. Quantum mechanically, however, that
20
+ same space resembles a sea of virtual particles appearing and disappearing all the
21
+ time. This result is due to the fact that the vacuum still possesses a zero-point
22
+ energy. Consequently, the electromagnetic field of the vacuum exhibits random fluctuations
23
+ in phase and amplitude at all frequencies. By carefully measuring these fluctuations,
24
+ we are able to generate ultra-high bandwidth random numbers.
25
+ email: henriqueutsch@gmail.com
26
+ executables: []
27
+ extensions: []
28
+ extra_rdoc_files: []
29
+ files:
30
+ - test/eva_ia_robot_test.rb
31
+ - qrng/qrng.rb
32
+ - Rakefile
33
+ - ruby_qrnq.gemspec
34
+ has_rdoc: true
35
+ homepage: https://github.com/henriqueutsch/Ruby-qrng
36
+ licenses: []
37
+ post_install_message:
38
+ rdoc_options: []
39
+ require_paths:
40
+ - lib
41
+ required_ruby_version: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ required_rubygems_version: !ruby/object:Gem::Requirement
48
+ none: false
49
+ requirements:
50
+ - - ! '>='
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ requirements: []
54
+ rubyforge_project:
55
+ rubygems_version: 1.5.2
56
+ signing_key:
57
+ specification_version: 3
58
+ summary: True adn real-time random numbers qrng.anu.edu.au
59
+ test_files: []