Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Search results

  1. N

    is "rand() % 100;" not very random?

    It's a very standard linux environment as I insinuated earlier in the thread.
  2. N

    is "rand() % 100;" not very random?

    Still not very easy, i think knowing what %lu was as a data type would be just as important as knowing the numeric value of a function. And my code that i posted before is bad, i even labeled it as such. Yet, i will surely be on to something when i know WHY its bad.
  3. N

    is "rand() % 100;" not very random?

    Donald Knuth's series of books is kinda old, from 1968, and that book you referenced is no. 2 in a series of 7 volumes. Seeing this obviously honest/knowledgeable review, i think there are probably much better options out there, even if they are hard to find: The definitive work on programming...
  4. N

    is "rand() % 100;" not very random?

    Okay, so mapping 10 numbers between a quadrillion possibilities divided by 10 probably did work, i can already see that it's not biased towards low numbers anymore. Doing more testing would be tedious, I would like to actually try to figure out what the other suggestions do now... sed -n...
  5. N

    is "rand() % 100;" not very random?

    *Sigh*, nobody needs to read books in order to understand things, even though books are pretty fun to read and I might buy it :) The code above is choosing from a pool of a quadrillion numbers with the long double data type...from 0 to... *takes deep breath* nine-hundred and ninety-nine...
  6. N

    is "rand() % 100;" not very random?

    I don't know, maybe we are over-complicating the issue. I've noticed through doing this as well, that to a human, you always start counting at 1. If you are a computer, you always start counting at 0. To a human...0 basically means "non-existent", whereas a robot/computer couldn't possibly...
  7. N

    is "rand() % 100;" not very random?

    I think it would have to be based on values and it would be interesting to know more.
  8. N

    Bash script for diagnosing problems with running software inside of terminal

    This script is actually kinda unnecessary on a linux system because you just have to try running a program through the terminal in order to figure out that you haven't installed it: kerblunk kerblunk: command not found However, if you are looking for more information, then this script might...
  9. N

    is "rand() % 100;" not very random?

    That's a neat program, thank you for posting it here and helping me figure out how to run it correctly.
  10. N

    is "rand() % 100;" not very random?

    So that reveals that if you used C to print the small numbers, but mapped them to big numbers (very easy with if/else and a little bit of division), then that takes care of the fact that rand() tends to be biased towards the small numbers.
  11. N

    Compare your text files in a nuanced/complex way

    Here is a bash script (on windows, i think "git for windows" would allow you to run this, the commands are typically native to linux...) that allows you to print lines that match or are different in a file: #!/bin/bash #easier to read format for showing differences between files SCRIPT=$0...
  12. N

    is "rand() % 100;" not very random?

    I haven't tested your code, but that is the best way to try to make a random number generator.
  13. N

    is "rand() % 100;" not very random?

    Well, I effectively skewed the results more to the upper half of the numbers, but now it just does the same thing in reverse: #include <stdio.h> #include <stdlib.h> #include <time.h> #include <unistd.h> int main (){ int i; for ( i=0; i<1000; i++ ) { //assign int n...
  14. N

    is "rand() % 100;" not very random?

    The purpose of having two rands() is to skew the bias away from it more frequently choosing the lower half of the numbers. Everytime someone writes their code, they are doing it in a way that suits them or their clients/employer, correct? I think your code is interesting and I'll scrutinize it...
  15. N

    is "rand() % 100;" not very random?

    Here's what i talked about (using the double if statements) in C, it seems to still be biasing towards lower numbers, so i would need to a add a couple more conditions: #include <stdlib.h> #include <time.h> #include <unistd.h> int main (){ int i; for ( i=0; i<1000; i++ ) { //assign...
  16. N

    is "rand() % 100;" not very random?

    I actually left my computer on for a while and collected 25,000 lines in a document...it's funny, 1,000,000 seconds is actually a long time in terms of a human life if you watch the time fly. Kinda makes you think...i don't like leaving my computer on for huge periods of time. Anyways, that is...
  17. N

    is "rand() % 100;" not very random?

    Oh, well basically just a reliable psuedo-random number generator that has small values. The small values of course aren't practical for making something like that, but it's just easier for a beginner to grasp, and also just to me "a cool idea". Grappling with that stack exchange question was...
  18. N

    is "rand() % 100;" not very random?

    Oh i was think maybe i could have 2 random number generators, and the one could just generate values for and if statement, then it skews the value a certain way if it one of the numbers for the if statement is chosen, yesterday was a really bad day for some reason but i still think rand is...
  19. N

    is "rand() % 100;" not very random?

    Ok, sorry, i truly regret posted any of that
  20. N

    is "rand() % 100;" not very random?

    Nobody here is avoiding these patterns: but what if you wanted to have your program cough up digit 0 through 9 in a "truly random" fashion? To me, that is interesting. What is a truly random number? Does it even exist?The fact that nobody seems to want to address the actual function that this is...
Back
Top Bottom