Skip to content
Open
Show file tree
Hide file tree
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
10 changes: 10 additions & 0 deletions MTRandom.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,18 @@
objects = {

/* Begin PBXBuildFile section */
4138808117A3475400FB55B5 /* MTRandom64.m in Sources */ = {isa = PBXBuildFile; fileRef = 4138808017A3475400FB55B5 /* MTRandom64.m */; };
4138808317A3476100FB55B5 /* mtrandom64Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4138808217A3475D00FB55B5 /* mtrandom64Tests.m */; };
6698DF8015F41C9B00B74390 /* SenTestingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6698DF7F15F41C9B00B74390 /* SenTestingKit.framework */; };
6698DF8715F41C9B00B74390 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6698DF8515F41C9B00B74390 /* InfoPlist.strings */; };
6698DF8A15F41C9B00B74390 /* MTRandomTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6698DF8915F41C9B00B74390 /* MTRandomTests.m */; };
6698DF9815F4452100B74390 /* MTRandom.m in Sources */ = {isa = PBXBuildFile; fileRef = 6698DF9715F4452100B74390 /* MTRandom.m */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
4138807F17A3475400FB55B5 /* MTRandom64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTRandom64.h; sourceTree = "<group>"; };
4138808017A3475400FB55B5 /* MTRandom64.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MTRandom64.m; sourceTree = "<group>"; };
4138808217A3475D00FB55B5 /* mtrandom64Tests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = mtrandom64Tests.m; sourceTree = "<group>"; };
6698DF5B15F4103400B74390 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
6698DF7E15F41C9B00B74390 /* MTRandomTests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MTRandomTests.octest; sourceTree = BUILT_PRODUCTS_DIR; };
6698DF7F15F41C9B00B74390 /* SenTestingKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SenTestingKit.framework; path = Library/Frameworks/SenTestingKit.framework; sourceTree = DEVELOPER_DIR; };
Expand Down Expand Up @@ -70,6 +75,7 @@
6698DF8215F41C9B00B74390 /* MTRandomTests */ = {
isa = PBXGroup;
children = (
4138808217A3475D00FB55B5 /* mtrandom64Tests.m */,
6698DF8815F41C9B00B74390 /* MTRandomTests.h */,
6698DF8915F41C9B00B74390 /* MTRandomTests.m */,
6698DF8315F41C9B00B74390 /* Supporting Files */,
Expand All @@ -90,6 +96,8 @@
6698DF9015F4449300B74390 /* MTRandom */ = {
isa = PBXGroup;
children = (
4138807F17A3475400FB55B5 /* MTRandom64.h */,
4138808017A3475400FB55B5 /* MTRandom64.m */,
6698DF9615F4452100B74390 /* MTRandom.h */,
6698DF9715F4452100B74390 /* MTRandom.m */,
);
Expand Down Expand Up @@ -175,8 +183,10 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
4138808117A3475400FB55B5 /* MTRandom64.m in Sources */,
6698DF8A15F41C9B00B74390 /* MTRandomTests.m in Sources */,
6698DF9815F4452100B74390 /* MTRandom.m in Sources */,
4138808317A3476100FB55B5 /* mtrandom64Tests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDESourceControlProjectIdentifier</key>
<string>B44BD6B2-6E83-428F-A6A9-EBB0B9039421</string>
<key>IDESourceControlProjectName</key>
<string>MTRandom</string>
<key>IDESourceControlProjectOriginsDictionary</key>
<dict>
<key>F8F761A8-19D3-4CA0-A183-7D2F7C83994C</key>
<string>ssh://github.com/alimoeeny/MTRandom.git</string>
</dict>
<key>IDESourceControlProjectPath</key>
<string>MTRandom.xcodeproj/project.xcworkspace</string>
<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
<dict>
<key>F8F761A8-19D3-4CA0-A183-7D2F7C83994C</key>
<string>../..</string>
</dict>
<key>IDESourceControlProjectURL</key>
<string>ssh://github.com/alimoeeny/MTRandom.git</string>
<key>IDESourceControlProjectVersion</key>
<integer>110</integer>
<key>IDESourceControlProjectWCCIdentifier</key>
<string>F8F761A8-19D3-4CA0-A183-7D2F7C83994C</string>
<key>IDESourceControlProjectWCConfigurations</key>
<array>
<dict>
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
<string>public.vcs.git</string>
<key>IDESourceControlWCCIdentifierKey</key>
<string>F8F761A8-19D3-4CA0-A183-7D2F7C83994C</string>
<key>IDESourceControlWCCName</key>
<string>MTRandom</string>
</dict>
</array>
</dict>
</plist>
21 changes: 9 additions & 12 deletions MTRandom/MTRandom.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,34 @@
@interface MTRandom : NSObject <NSCoding, NSCopying>

// Initialize with a given seed value. This is the designated initializer
- (id)initWithSeed:(uint32_t)seed;
- (id) initWithSeed:(uint32_t)seed;

// Seed the generator with the current time.
- (id)init;

- (id) init;

// generates a random number on [0,0xffffffff]-interval
- (uint32_t)randomUInt32;
- (uint32_t) randomUInt32;

// generates a random number on [0,1]-real-interval
- (double)randomDouble;
- (double) randomDouble;

// generates a random number on [0,1)-real-interval
- (double)randomDouble0To1Exclusive;
- (double) randomDouble0To1Exclusive;

@end


@interface MTRandom (Extras)

- (BOOL)randomBool;
- (BOOL) randomBool;

- (uint32_t)randomUInt32From:(uint32_t)start to:(uint32_t)stop;
- (uint32_t) randomUInt32From:(uint32_t)start to:(uint32_t)stop;

- (double)randomDoubleFrom:(double)start to:(double)stop;
- (double) randomDoubleFrom:(double)start to:(double)stop;

@end


@interface NSArray (MTRandom)

- (id)mt_randomObjectWithRandom:(MTRandom *)r;
- (id) mt_randomObjectWithRandom:(MTRandom *)r;

@end
Loading