Skip to content

[stdlib] Remove _random() customization point #17604

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

Merged
merged 1 commit into from
Jul 2, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 1 addition & 15 deletions stdlib/public/core/Integers.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -2421,10 +2421,6 @@ ${operatorComment(x.operator, False)}
${assignmentOperatorComment(x.operator, False)}
static func ${x.operator}=(_ lhs: inout Self, _ rhs: Self)
% end

static func _random<R: RandomNumberGenerator>(
using generator: inout R
) -> Self
}

extension FixedWidthInteger {
Expand Down Expand Up @@ -3025,6 +3021,7 @@ ${assignmentOperatorComment('&' + x.operator, True)}
}

extension FixedWidthInteger {
@inlinable
public static func _random<R: RandomNumberGenerator>(
using generator: inout R
) -> Self {
Expand Down Expand Up @@ -4045,17 +4042,6 @@ public func _assumeNonNegative(_ x: ${Self}) -> ${Self} {
}
% end

extension ${Self} {
@inlinable
public static func _random<R: RandomNumberGenerator>(
using generator: inout R
) -> ${Self} {
var result: ${Self} = 0
withUnsafeMutableBytes(of: &result) { generator._fill(bytes: $0) }
return result
}
}

//===--- end of FIXME(integers) -------------------------------------------===//

% end # end of concrete FixedWidthInteger section
Expand Down