fraction_life 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/fraction_life.rb +18 -0
  3. metadata +44 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: be30985cbc5e7d2ec929a22129b92241c11ddda2
4
+ data.tar.gz: c922ff83c709117c38c7928b10c9112dc559babc
5
+ SHA512:
6
+ metadata.gz: 75038153aee903c4bae7cba08fa01b7293630ae496f737373ee286f6c2a21d148fe2b508b50dd4bcb9250b7ca5c8117561cb85ae1fdaf3d4e8ac8c93c4253f67
7
+ data.tar.gz: a0367e15d971e172823938e5af5bbb3d774c7e5d529a03e3cdd5617bf7dfb106146a51be9d59279e9ba381e6dd599c9e451ace95c7e9e18fc9fdae2ba8bf3a50
@@ -0,0 +1,18 @@
1
+ #---------------------------------------------------------------------------
2
+ # FractionLife
3
+ #
4
+ module FractionLife
5
+ def self.generate(odds=0.5, start=1)
6
+ # $tm.hrm
7
+
8
+ # check random value
9
+ if rand() <= odds
10
+ return start
11
+ else
12
+ return self.generate(odds, start+1)
13
+ end
14
+ end
15
+ end
16
+ #
17
+ # FractionLife
18
+ #---------------------------------------------------------------------------
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fraction_life
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Mike O'Sullivan
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-11-04 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Returns an integer with each value half the probability of the previous
14
+ email: miko@idocs.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/fraction_life.rb
20
+ homepage: https://rubygems.org/gems/fraction_life
21
+ licenses:
22
+ - MIT
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubyforge_project:
40
+ rubygems_version: 2.5.2.1
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: Weighted randomizer
44
+ test_files: []