Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
  • 1 commit
  • 3 files changed
  • 0 commit comments
  • 1 contributor
Commits on Mar 21, 2018
* Allows more than 50 tips

* Fixes 64bit build
* Fixes #21
Showing with 13 additions and 20 deletions.
  1. +7 −14 source/Shuffle.cpp
  2. +3 −4 source/Shuffle.h
  3. +3 −2 source/Tipster.h
@@ -5,31 +5,24 @@
#include "Shuffle.h"


void
Swap(int* a, int* b)
{
int temp = *a;
*a = *b;
*b = temp;
}

// don't use random_shuffle deprecated in the future...

void
Randomize(int* arr, int n)
Randomize(std::vector<int> &arr)
{
srand ( time(NULL) );

for(int i = n - 1; i > 0; i--) {
for(int i = arr.size() - 1; i > 0; i--) {
int j = rand() % (i+1);
Swap(&arr[i], &arr[j]);
std::swap(arr[i], arr[j]);
}
}


void
CreateRandomSeq(int* arr, int len)
CreateRandomSeq(std::vector<int> &arr, int len)
{
for(int i = 0; i < len; ++i)
arr[i] = i;
Randomize(arr, len);
arr.push_back(i);
Randomize(arr);
}
@@ -8,11 +8,10 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <vector>


void Swap(int* a, int* b);
void Randomize(int* arr, int n);
void CreateRandomSeq(int* arr, int len);
void Randomize(std::vector<int> &arr);
void CreateRandomSeq(std::vector<int> &arr, int len);

#endif

@@ -15,6 +15,7 @@
#include <StringList.h>
#include <TextView.h>

#include <vector>

class Tipster : public BGroupView
{
@@ -55,8 +56,8 @@ class Tipster : public BGroupView
BStringList fTipsList;
int32 fTipsLength;
int32 fTipIndex;
int fRandomSeq1[50];
int fRandomSeq2[50];
std::vector<int> fRandomSeq1;
std::vector<int> fRandomSeq2;

BString* fPreviousTip;
BString* fCurrentTip;

No commit comments for this range

You can’t perform that action at this time.