New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Random function #968

Merged
merged 3 commits into from Feb 1, 2014

Conversation

Projects
None yet
3 participants
@chriseppstein
Member

chriseppstein commented Oct 15, 2013

Lots of people at SassConf want this. so here it is.

@chriseppstein

This comment has been minimized.

Member

chriseppstein commented Dec 12, 2013

@nex3 Please review. You promised this would get into 3.3. Though you may have been too drunk to remember. But I have a witness: @Snugug ;)

@Snugug

This comment has been minimized.

Contributor

Snugug commented Dec 12, 2013

I am a witness!

On Dec 11, 2013, at 8:04 PM, Chris Eppstein notifications@github.com wrote:

@nex3 Please review. You promised this would get into 3.3. Though you may have been too drunk to remember. But I have a witness: @Snugug ;)


Reply to this email directly or view it on GitHub.

# @return [Integer] The same seed.
def self.random_seed=(seed)
@random_number_generator = Random.new(seed)
seed

This comment has been minimized.

@nex3

nex3 Dec 14, 2013

Contributor

This is unnecessary; Ruby automatically returns the right-hand side of an assignment, even if the assignment method itself doesn't return its argument. Similarly, the doc comment describing this return value is unnecessary.

@@ -2168,6 +2186,25 @@ def inspect(value)
end
declare :inspect, [:value]
# @overload random()
# Return a decimal between 0 and 1.
# @param $limit The maximum of the random integer to be returned.

This comment has been minimized.

@nex3

nex3 Dec 14, 2013

Contributor

Copy/paste error?

Kernel.rand(*args)
end
end
end

This comment has been minimized.

@nex3

nex3 Dec 14, 2013

Contributor

Let's move this shim into Sass::Util.

@@ -2168,6 +2186,25 @@ def inspect(value)
end
declare :inspect, [:value]
# @overload random()
# Return a decimal between 0 and 1.

This comment has been minimized.

@nex3

nex3 Dec 14, 2013

Contributor

Inclusive or exclusive?

end
assert_nothing_raised do
evaluate("random()")
end

This comment has been minimized.

@nex3

nex3 Dec 14, 2013

Contributor

Let's at least assert that this is within the expected range.

# @return [Sass::Script::Number] An integer.
def random(limit = nil)
if limit
assert_integer limit, "limit"

This comment has been minimized.

@nex3

nex3 Dec 14, 2013

Contributor

We should check that limit is greater than zero, and test that check below.

@nex3

This comment has been minimized.

Contributor

nex3 commented Dec 14, 2013

Done reviewing (and I remember agreeing to this, don't worry).

@hcatlin hcatlin referenced this pull request Jan 4, 2014

Merged

Random function with Fixes #1062

nex3 added a commit that referenced this pull request Feb 1, 2014

@nex3 nex3 merged commit c7d5bf2 into master Feb 1, 2014

1 check passed

default The Travis CI build passed
Details

@nex3 nex3 deleted the random_function branch Feb 1, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment