Skip to content

Commit

Permalink
fix: remove rng solutions
Browse files Browse the repository at this point in the history
  • Loading branch information
tolstenko committed Sep 16, 2024
1 parent 8d890f8 commit 80c759a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 44 deletions.
14 changes: 1 addition & 13 deletions docs/artificialintelligence/assignments/rng/rng.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,9 @@ int main(){
// code here
unsigned int seed, N, min, max;
std::cin >> seed >> N >> min >> max;
unsigned int i;
for(i = N; i >= 1; i--)
{
//Run xor shift
seed = xorShift(seed, min, max);
}
}
//The purpose of this function is to take the number and xor shift it to output a pseudo-random number
unsigned int xorShift(unsigned int seed, int r1, int r2)
{
seed = seed xor (seed << 13);
seed = seed xor (seed >> 17);
seed = seed xor (seed << 5);
int value = r1 + (seed % (r2 - r1 + 1)); //clamps the value to between r1 and r2
//output the new values
std::cout << value << std::endl;
return seed;

}
31 changes: 0 additions & 31 deletions docs/artificialintelligence/assignments/rng/rng_tolsta.cpp

This file was deleted.

0 comments on commit 80c759a

Please sign in to comment.